Probably the following line is causing this issue:
UIImage *selectedImage = (UIImage *)[selectedCell viewWithTag:100];
When you use viewWithTag:
it'll return the UIImageView
associated with the cell, not the UIImage
.
You need to change it like:
UIImageView *selectedImageView = (UIImageView *)[selectedCell viewWithTag:100];
UIImage *selectedImage = selectedImageView .image;
For passing data, store the selected image in a instance variable (Say selectedImage) and you need to implement the prepareForSegue:
like:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"GotoDetail"])
{
YourDetailType *detailController = segue.destinationViewController;
detailController.imageProperty= self.selectedImage;
}
}