Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am developing one application. In that I use the tableview with 4 rows. Each row contains the one textview and one imageview. These imageviews take the image from the camera.

At the time of testing on device, first three images are loaded correctly. After taking the 4th image, remaining three images are become black and if you scroll the tableview then the remaining data is also lost.

How can I fix this?

Below one is the CellForRowindex method for declare the imageviews.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

UITableViewCell *cell=[[UITableViewCell alloc]init];
itemimageView=[[UIImageView alloc]initWithFrame:CGRectMake(5, 6, 90, 90)];
[itemimageView.layer setBorderWidth:1.0f];
[itemimageView.layer setBorderColor:[[UIColor grayColor] CGColor]];
[itemimageView.layer setCornerRadius:10.0f];
 itemimageView.layer.masksToBounds = YES;
[itemimageView setContentMode:UIViewContentModeScaleAspectFill];

UILabel *lblTemp1=[[UILabel alloc]initWithFrame:CGRectMake(100, 8, 220, 20)];
lblTemp1.font = [UIFont boldSystemFontOfSize:17];
txtView=[[UITextView alloc]initWithFrame:CGRectMake(90,20,220,69)];
txtView.delegate = self;
txtView.font=[UIFont italicSystemFontOfSize:13];
txtView.backgroundColor=[UIColor clearColor];

     if([[odrdata stringForKey:@"keyToBvrgImage"] isEqualToString:@""])  
    //itemimageView.image=[UIImage imageNamed:@"thumb_mdpi.png"];
     itemimageView.image=[UIImage imageWithData:[odrdata objectForKey:@"keyToBvrgImage"]];

    itemimageView.userInteractionEnabled = YES;
       lblTemp1.text=[odrname objectAtIndex:indexPath.row];

if([[odrdata stringForKey:@"keyToBvrgText"] isEqualToString:@""])
txtView.text=@"I had...";
    txtView.text=[odrdata valueForKey:@"keyToBvrgText"];

[cell.contentView addSubview:txtView];
[cell.contentView addSubview:lblTemp1];
[cell.contentView addSubview:itemimageView];
[lblTemp1 release];


Like this i write the code for every orw in the tableview.So Please tell me how can i fix it.

share|improve this question
add comment

closed as off topic by Kyle Cronin Sep 7 '11 at 5:04

Questions on Ask Different are expected to relate to Apple hardware or software within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.