objective c - Segue causes breakpoint when clicking the cell to Detail view -
the cell in collection view causes breakpoint when clicked show larger image in detail view. cells display images should detail view isn't displaying image. if need more info form part, let me know. clues provided are. (lldb)
{ @autoreleasepool { return uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class])); [breakpoint] } } code generates cell information , passes through segue. - (uicollectionviewcell *)collectionview:(uicollectionview *)cv cellforitematindexpath:(nsindexpath *)indexpath; { // code 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 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 uiimage ui imageview } @end
said error :
( setvalue:forundefinedkey:]: class not key value coding-compliant key image.')
assuming use storyboards, think did 1 of following things:
double-check consistency between storyboard , code ! hope helps!
Comments
Post a Comment