Thursday, 15 April 2010

objective c - Subclass collection view: execution was interrupted, reason: Attempted to dereference an invalid ObjC Object -



objective c - Subclass collection view: execution was interrupted, reason: Attempted to dereference an invalid ObjC Object -

i implemented collection view within collection view cell property

#import <uikit/uikit.h> #import "emsubcollectionview.h" @interface emyearcell : uicollectionviewcell -(void)setcollectionviewdatasourcedelegate:(id<uicollectionviewdatasource>)datasourcedelegate index:(nsinteger)index currentsection:(nsinteger)section; @property (strong, nonatomic) iboutlet emsubcollectionview *collectionview; @property (strong, nonatomic) iboutlet uilabel *monthheader; @end

the method in implementation looks this:

-(void)setcollectionviewdatasourcedelegate:(id<uicollectionviewdatasource>)datasourcedelegate index:(nsinteger)index currentsection:(nsinteger)section { self.collectionview.datasource = datasourcedelegate; self.collectionview.tag = index; self.collectionview.numberofcurrentsection = section; [self.collectionview reloaddata]; }

i wanted give collection view sec "tag-property", subclassed corresponding collectionview property:

#import <uikit/uikit.h> @interface emsubcollectionview : uicollectionview @property nsinteger numberofcurrentsection; @end

when run app, crashes:

what wrong code? in advance.

solution pretty simple: forgot assign new class corresponding collection view in storyboard. works charm.

objective-c uicollectionview unrecognized-selector

No comments:

Post a Comment