-2

集合视图中的单元格在单击以在详细视图中显示较大的图像时会导致断点。单元格按应有的方式显示图像,但详细视图未显示图像。如果您需要更多信息,请告诉我。提供的线索是。(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
4

1 回答 1

1

你说的错误是:
( setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key image.')

假设您使用故事板,我认为您做了以下事情之一:

  • 修改与您的 IBOutlets 的连接(当然是您的图像)
  • 重命名一个属性
  • 从您的代码中删除了一个属性而不删除情节提要中的连接
  • 指定给您的视图控制器之一的类与您在代码中使用的类不同
  • 仔细检查故事板和代码之间的一致性!我希望它有帮助!

    于 2013-09-03T16:02:56.983 回答