objective c - How to load image for uitableviewcell before -


I have tried a lot of ways while studying about my similar problem, but I did not find the correct answer and I asked Straight. Here's my job I want the user to launch their app and see the cells with images that I load from the web, but I just see the title!

Then I scroll up and do not appear on some cell screens.

And after that I only see the image for that cell

Here is my code:

  - (NSInteger) tableView :. (UITableView *) Table view numberofrose insubstation: (NSINtegaard) volume {return 5; } - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * reusbleCell = @ "cell"; UITableViewCell * cell = [tableview decouwer reusable light identifier: RecycleBec;]; If (cell!) {Cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: reusbleCell]; } Dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {NSURL * imageUrl = [[NSURL alloc] initWithString: @ "http://cs413627.vk.me/v413627067/604c/gD39fdeTH-E.jpg"]; NSData * imageData = [[NSData alloc] initWithContentsOfURL: imageUrl]; dispatch_async (dispatch_get_main_queue (), ^ {[[cell imageView] setImage: [UIImage imageWithData: imageData]];});}); [[Cell Text Labels] Set Text: @ "Text"]; Return cell; }    

I have created a test project to investigate the reason, I came to know If you do not return the cell before setting the cell.imageView.image , cell.imageView.frame will be CGRectZero.So when imageData receive, you had set imageView.image with imageData , But the image will

I think you can customize a UITableViewCell with optimized UIImageView.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -