How to run the application in iphone device with out loss of data?
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.editable=YES;
txtView.font=[UIFont italicSystemFontOfSize:13];
txtView.backgroundColor=[UIColor clearColor];
txtView.enablesReturnKeyAutomatically=YES;
if(indexPath.row==0)
{
if([[odrdata stringForKey:@"keyToBvrgImage"] isEqualToString:@""]) //indexPath.row==selectedRow)
{
//itemimageView.image=[UIImage imageNamed:@"thumb_mdpi.png"];
}
else
{
itemimageView.image=[UIImage imageWithDat开发者_如何学JAVAa:[odrdata objectForKey:@"keyToBvrgImage"]];
}
itemimageView.userInteractionEnabled = YES;
itemimageView.tag=0;
lblTemp1.text=[odrname objectAtIndex:indexPath.row];
if([[odrdata stringForKey:@"keyToBvrgText"] isEqualToString:@""])
{
txtView.text=@"I had...";
}
else
{
txtView.text=[odrdata valueForKey:@"keyToBvrgText"];
}
txtView.tag=0;
[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.
精彩评论