UITableView Lag when navigating to ItemDetailViewController


#1

I am experiencing a really bad lag when on the device when I click on the possession list to go to the detail view, I tested it and it has to be a side effect of
setting the imageView in viewWillAppear. So to avoid this issue wouldn’t you be better off placing the following code in viewDidAppear:

[code]NSString *imageKey = [possession imageKey];
if (imageKey)
{
// Get image for image key from image store
UIImage *imageToDisplay = [[ImageStore defaultImageStore] imageForKey];

    // Use that image to put on the screen in imageView
    [imageView setImage:imageToDisplay];
}
else
{
    // Clear the imageView
    [imageView setImage:nil];
}

[/code]

I know this will cause a slight delay displaying the image on the ItemDetailViewController, but I think this is better than the device looking like its slowing down and may even grind to a halt!
Any thoughts?


#2

One of the later challenges in the book, chapter 16, mentions this and prompts you to fix it. Should probably be mentioned in Chapter 13 though.

Basically the image you have from a camera is pretty large for what you are displaying.


#3

Thanks for the heads up :slight_smile: