iphone - Dynamically display images on tableview cells -


Based on their availability in the database in my application, I need to display an image or image on the tableview. I have installed four web views [to show pictures from URL] and I'm hiding or showing them on the basis of their achievement.

There may be no case when there is no image, when I 'completely hide the webview.

But after the random scroll, my application is crashing. Also, while scrolling, it shows me new images compared to the old, so I am able to see the first image, then after scrolling through the same cell, the two images lead each other [A part of the picture of the first appears] and similarly. Can this be due to cell-reusability? What is the best way about this issue?

Edit:

I am using the following code:

  noOfPhotos = [photos_array count]; If (noffoto> gt; 0) {commentWhenWebviewNotThere.alpha = 0.0; // Things which are not visible when there are no images, none; WhenWebViewTh = 0.0; Comments: ElblabViewset.Elpha = 0.0; Image1.hidden = No; Image2.hidden = No; Image3.hidden = No; Image4.hidden = No; CommentsLblWhenWebview.alpha = 1.0; NoOfComments.alpha = 1.0; Comment.alpha = 1.0; (NSInteger x = 0; x & lt; noOfPhotos; x ++) for {photoName = [photos_array objectAtIndex: x]; NSString * urlAddress = [NSString stringWithFormat: @ "% @", photoname]; NSURL * url = [NSURL URLWithString: urlAddress]; NSURLRequest * requestObj = [NSURL request request with url: url]; If (x == 0) {image1 = [[UIWebView alloc] initWithFrame: SegrechtMake (10, note. Frames.org) - 5, 60, 60); [Image load request: request obz]; // Load Request in UIWebView [Self Addiveview: Image 1]; } And if (x == 1) {image2 = [[UIWebView alloc] initWithFrame: CGRectMake (88, comment .frame.origin.y - 5, 60, 60)]; [Image2 loadRequest: requestObj]; // Load Request in UIWebView [Self-added SQL View: Image 2]; } And if (x == 2) {image3 = [[UIWebView alloc] initWithFrame: CGRectMake (16 9th, comment.fr.org.a-5, 60, 60)]; [Image3 loadRequest: requestObj]; // Load Request in UIWebView [Self Addiveview: Image 3]; } And if (x == 3) {image4 = [[UIWebView alloc] initWithFrame: CGRectMake (251, comment .frame.origin.y - 5, 60, 60)]; [Image4 loadRequest: requestObj]; // Load Request in UIWebView [Self-Compatibility: image4]; }}} {{CommentWhenWebviewNotThere.alpha = 1.0; // When images are not there, should be visible noFomommentsWebviewNotThere.alpha = 1.0; Comments: Elblabweviewset.alpha = 1.0; CommentsLLBSWebviewView Alpha = 0.0; NoOfComments.alpha = 0.0; Comment. Alpha = 0.0; Image1.hidden = Yes; Image2.hidden = Yes; Image3.hidden = Yes; Image4.hidden = Yes; }  

Thanax Advance

coupling !!! Cells are being reused! What if the cell is being reused, before the webview results are received? Please drag the image loading operation from your cell and put it into your controller cell should have four image views. And the controller should pass images for them.


Comments