Refreshing data from api after stretching the viewcontroller - iphone

I have noticed that applications like facebook and washington post have certain viewcontrollers where if you stretch the viewcontroller below it says that the data is getting to reload. I sense it a better way of reloading the data rather than everytime its being called at viewWillAppear. I am just curious what is that functionality called, and is there any example for this online?
Thanks

It's usually called Pull to Refresh or Pull Down Refresh.
https://github.com/enormego/EGOTableViewPullRefresh

Related

iOS Logout design

I have an app that has many web services and notifications going on. I need a logout feature. I wish there was a way simply to kill the app and restart it but there is not. Does anyone have some recommended guidelines on creating a logout function (it will take the user back to the login screen). The problem is there are notifs that should be unsubscribed from, views that should be removed, view controllers that I want to be released, then everything to reinitialize. That seems like a lot of work for a simple task. Any thoughts?
The first thing to make sure when terminating all requests is to change all delegates that are supposed to receive responses to nil. After you've taken care of this, you should indeed remove all irrelevant view controller's views from your root view (and release them if they are retained anywhere), and of course flush any existing data you don't need. If you design your MVC elegantly, you can achieve these actions without a lot of fuss, for example a ScreenManager Singleton class that manages all your view controllers should have no problem taking you back to the login screen while releasing any other view. A DataManager Singleton class that holds various data collections should have no problem removing any unneeded data entities and so on...

Disable animation of UITableView with NSFetchedResultsController when many rows are being changed

In my UIView I've got a UITableView (UITV) which is controlled by an NSFetchedResultsController (NSFRC). The UIView is inside a UINavigationController.
When the view is about to be loaded/displayed I start some background activities which fetch data from a remote server (JSON) and parse into Core Data.
The NSFRC is being called when the parsing is done and the threaded NSManagedObjectContext have been merged into the main context.
The problem is that sometimes many rows are being inserted to Core Data at once, a lot of table cells are being added and there is quite a delay from that the actual fetching and parsing is done, until the rows are being displayed.
Now I wonder if anyone knows of any solution to, for example:
hook up a spinner to some "fetched results controller inserted all its rows for this time" (or something) notification/delegate call to at least tell the user that "something is going to show up soon"?
Or might the best solution simply be to not initialize the NSFRC until the background fetching and processing is completed?
Thanks!
If I understand your question correctly, you may want to look into the NSFetchedResultsControllerDelegate methods, with documentation available here: http://developer.apple.com/library/ios/#documentation/CoreData/Reference/NSFetchedResultsControllerDelegate_Protocol/Reference/Reference.html
There are delegate methods available for pre changes with controllerWillChangeContent:, post changes with controllerDidChangeContent and during changes with didChangeSection: and didChangeObject.
I hope it helps!
Rog

my app crashes if i change views whilst downloading data

I have a tableview based app that downloads rss feeds from the web. So i have view1, i click a row in the table and the results show on view2. This works great but if i change back to view1 while the data is being downloaded. It crashes!
Any ideas what i need to change (its nsxmlparser by the way)?
Thanks
Some more information about the problem would be useful to understand what's going on, but based on what you posted my guess would be that you are setting a delegate for something (the NSXMLParser or the url connection, or maybe something else) and when you go back to view1, view2 gets destroyed, destroying the delegate object and leaving whoever it was with a dangling delegate pointer.

Getting a UIButton to send commands to another View Controller

Question..
I'm currently making a conversion app. I have for the first tab where the information is entered. Views 2 and 3 are where the information from view 1. I'm having an issue.. I'm not sure how to send the information from view 1 to view 2 and 3.
I've looked at examples.. but I'm still not quite grasping the idea of it. any suggestions?
Thanks!
Instead of thinking in terms of sending information between views, create a "model object" that contains all the data that is shared between views, and let controller classes take care of updating the views when the model is changed.
Also, take a look at the documentation for NSNotificationCenter for a way to "broadcast" data updates throughout your app.

help with table views on a uitabbarcontroller

im writing a news app, and im just planning it out in my head and need some help, before i start coding.
my app is a tab bar controller that is loading and displaying info from an xml feed. i am going to start the download of the xml within the app delegate in the background, so the app does not get closed down by the os, however this means that when my first table loads it will be blank , so i need a way of reloading the table once it has finished . i have encountered this issue before and couldnt work a way round it
last time i started the download of the info from the viewdidload method in the first view controller and tried a reloaddata , but that didn't seem to work. has anyone got a work around for this problem?
[yourTable reloadData] is the way to go.
Make sure to call it on the main thread, and that your data structure is actually holding the correct data.