iphone - cellForRowAtIndexPath nil during unit tests -
i'm trying write unit test uses tableview, , i'm having trouble accessing cells.
this nil:
- (void)testdidendeditingupdatesliftrecords { textviewcell *cell = (textviewcell *) [tableview cellforrowatindexpath:[nsindexpath indexpathforrow:0 insection:0]];
despite fact set data source in setup
- (void)setup { [super setup]; source = [[mydatasource alloc] init]; tableview = [[uitableview alloc] init]; [tableview setdatasource:source];
what
as docs say, uitableview
method cellforrowatindexpath:
returns "an object representing cell of table or nil
if cell not visible or indexpath
out of range." thus, if cell not visible on tableview, method return nil
.
note, method should not confused tableview:cellforrowatindexpath:
method implement in our uitableviewdatasource
. names confusingly similar.
Comments
Post a Comment