Tableviewcell controller uiviewimage slow - iphone

I have a uitableview cell that has an image like twitter app that I pull from the web via nsurl. I have it loading them in via the cells controller and of course when the user scrolls the app cOme to a crawl. How can only grab the images if/when scrolling stops if that is the best approach.
The other issue is I have that I call data refresh on the cell on viewdidload but that causes lag when the user comes out of the detail view back to the table. What method should I put my refresh call in. As I only need refresh if user pushes a refresh button or on initial tableview load.

Have a look at the http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html
The idea is to download images row per row and then display them when loaded in their rows without calling refresh ([tableView reloadData]) all the time - which causes "crawling".

Related

Multiple View Controllers being loaded at the same time. iPhone app

I am trying to create an app that swipes over through multiple view controllers on a UIScrollView - similar to how one would see different windows in the safari app, but instead of tapping a button to move between them, I am swiping the scroll view.
Now, I will be getting notifications when any of the data in a particular view is to be updated with some json. Should I be updating the view that aren't showing (but are on the scroll view), or should I wait until the user scrolls to that view?
I am very concerned about performance here. Hopefully I am being clear in the question.
Thanks!
You should update the views next to the view that you are viewing I would say. And when you switch (scroll) to another view, then update the views next to that view. (Assuming you have received new JSON data)

Puzzle tableview with tableviewcell...?

I have a small query.I have made an application in which i am fetching information from the webservice and i am displaying it on the table view.The table view which i a using is customized one in which i have used the text and the image property.
These things are working fine but now i have added a button ,once i click on it then a new view appears which has 2 options for 2 countries whose webservices are provided to me ,once i click on one button and see the table view then the list of the previous table view only appears and if i scroll through the whole list then the values changes which is according to the webservice.
So kindly suggest me as in what should be the approach of directly showing the updated tablecells.
[tableView reloadData];
call it explicitly from the secon view, or you can put it in viewWillAppear

Reload data in UItableview using a button

I want to add a refresh button in UINavigationBar that refreshes the entire table contents. Nothing happens when i click on the refresh button.
I searched google and found that reloadData method refreshes the tableview so I tried using it.
Are you sure your tableView outlet is linked correctly to your tableView property in Interface Builder ?
Is your internal datasource `refreshed' before you call reloadData?
-[UITableView reloadData] tells the table view to request again from you the number of rows in the table, and the cells at each section and row. It's up to you to update your internal data structures as appropriate. So in this case, your IBAction should call your own method to refetch the data from the server.
A few other notes:
Method names should have leading lowercase.
-initWithContentsOfURL: is blocking. This can hang your program for a long time. You should be using asynchronous fetching here (generally with NSURLConnection).
make sure you have the tableView outlet hooked up to the tableView.

UINavigationController reloading UITableView

In my application I am parsing XML to create a UITableView. When a user selects a row it changes the file that it is parsing and reloads the UITableView.
I want to create a back button so that the user can go back the the previous XML page they were viewing.
In short how can I tell the navigation controller to create a back arrow for this page when all i am doing is reloading my UITableView?
I'd strongly suggest building another controller (i.e. UITableViewController) and push that instead of just reloading the table. This makes the button automagically, and (major plus here), it animates the whole digging down / stepping back in a way that the user is expecting it.
As a side note, I didn't manage to get a back-style button once I tried it, just a plain normal button (make a new button and set it at the navigation bar).
What you're describing is a navigation. Rather than reloading the table's data, simply push a new view controller onto the navigation stack every time a row is tapped. This is a fundamental pattern in iPhone development. Here is Apple sample code for a multi-level drill down table view.

iPhone app - Show UIActivityIndicator while an IBAction is performed

I want a button in my navbar which lets the user refresh the contents of a tableview. The tableview is already populated and once the user presses the refresh button, I want to show a UIActivityIndicator while I fetch the items to be displayed on the table.
I tried putting a [indicator startAnimating] before calling the method to get the new data of the table (where indicator is of type IBOutlet UIActivityIndicator* and mapped to a control in IB) but the indicator does not show up. Instead, the navbar refresh button is in the pressed position till control returns from this IBAction method.
How can I show the indicator while the method execution completes?
Thanks.
You need to get the new data for the table in the background. That could be an asynchronous network call or a thread depending on what your refresh code does but the UI kind of assumes that button presses are pretty much instantaneous.
You'll note that your whole UI locks up (not just the refresh button), so this is a good thing to do anyway albeit much harder to implement.