コレクション ビューにあるセルをクリックすると、ブレークポイントが発生し、詳細ビューに大きな画像が表示されます。セルには画像が表示されますが、詳細ビューには画像が表示されません。私の側からさらに情報が必要な場合は、お知らせください。提供される手がかりは次のとおりです。(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