我在UITableViewCell中显示多个图像,如缩略图图像。但我很努力地检索选定的UITableViewCell的图像。我必须这样做才能在另一个ViewController中显示图像。我真的很努力解决这个问题。如何检索UITableViewCell的缩略图图像
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"MyCell"];
if (cell==nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CellIdentifier"];
}
jsonDict = [jsonArr objectAtIndex:indexPath.row];
//NSLog(@"imagess%@",jsonDict);
cell.textLabel.text = [jsonDict objectForKey:@"ImageName"];
stringg=[NSString stringWithFormat:@"%@",cell.textLabel.text];
cell.textLabel.textAlignment=NSTextAlignmentCenter;
NSData *imgData = [NSData dataWithBase64EncodedString:[jsonDict objectForKey:@"ImageData"]];
imageView.image=[UIImage imageWithData:imgData];
}
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSLog(@"%@",cell);
NSString *textname=[NSString stringWithFormat:@"%@",cell.textLabel.text];
NSLog(@"%@",textname);
UIImage *image1 =selectedCell.imageView.image;
age.ageimgae=image1;
}
图像使用
NSUSerdefault
或singleton
或SharedInstance
,别的另一个视图控制器..有u显示页面中cellforatindexpath的屏幕截图和代码的图像和didselectrowatindexpath –
立即检查... @ Anbu.Karthik –
让你显示页面的截图 –