ios - dataSource is nil in initWithCoder -
i have following initwithcoder implementation depends on callback of datasource method. somehow datasource nil , datasource methods aren't called. i'm using storyboard , therefor have overwritten initwithcoder-method.
- (id)initwithcoder:(nscoder *)adecoder { self = [super initwithcoder:adecoder]; if (self) { nsuinteger rows = 0; nsuinteger columns = 0; if (self.datasource && [self.datasource respondstoselector:@selector(numberofheaderrowsinspreadsheetview:)]) { rows = [self.datasource numberofheaderrowsinspreadsheetview:self]; } if (self.datasource && [self.datasource respondstoselector:@selector(numberofheadercolumnsinspreadsheetview:)]) { columns = [self.datasource numberofheadercolumnsinspreadsheetview:self]; } [self setupwithnumberofheaderrows:rows numberofheadercolumns:columns]; } return self; }
does has clue?
thanks in advance.
i wouldn’t surprised if storyboard connections haven’t been made yet in -initwithcoder:
(although haven’t tested it). try doing checks later, in viewwillappear:
.
Comments
Post a Comment