集合视图中的单元格在单击以在详细视图中显示较大的图像时会导致断点。单元格按应有的方式显示图像,但详细视图未显示图像。如果您需要更多信息,请告诉我。提供的线索是。(lldb)
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); [BREAKPOINT]
}
} The code that generates the cell information and passes through the segue.
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath;
{
// code for the custom cell created:
Cell *cell = [cv dequeueReusableCellWithReuseIdentifier:kCellID_Biffy forIndexPath:indexPath];
// load image
NSString *imageToLoad_Biffy = [NSString stringWithFormat:@"%d_Biffy.jpg", indexPath.row];
cell.image.image = [UIImage imageNamed:imageToLoad_Biffy];
return cell;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail_biffy"])
{
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] objectAtIndex:0];
// loads the image
NSString *imageNameToLoad = [NSString stringWithFormat:@"%d_Biffy", selectedIndexPath.row];
NSString *pathToImage = [[NSBundle mainBundle] pathForResource:imageNameToLoad ofType:@"jpg"];
UIImage *image2 = [[UIImage alloc] initWithContentsOfFile:pathToImage];
;
Detail_ViewController_Biffy *detailViewController = [segue destinationViewController];
detailViewController.image2 = image2;
}
} NEW CODE:
@interface Detail_ViewController_Biffy ()
@property (strong, nonatomic) IBOutlet UIImageView *images;
@end
@implementation Detail_ViewController_Biffy
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.images.image = self.image2; <------yellow sign Incompatible pointer types assigning to UIImage from Ui IMageview
}
@end