i have cell defined in storyboard, , have
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"ttentry" forindexpath:indexpath];
which gives me cell, , can configure it, , displays fine.
however, when try add new cell using
[self.tableview insertrowsatindexpaths:[[nsarray alloc] initwithobjects: indexpath, nil] withrowanimation:uitableviewrowanimationautomatic];
the result new cell half initialised , half drawn. when select cell, rest draws, of uninitialised.
it feels storyboard hasn't completed creating ui objects cell time returns cell dequeuereusablecellwithidentifier
.
i'm assuming i'm doing stupid, i've re-read uitableview manual again, , looked on code, , can think of there race condition happening somehow.
incidentally, failure pattern appears same each time run - second , third cells created way wrong, 4th seems ok doesn't gain focus, 5th fails again , 6th works perfectly.
update 09/06/15 i've continued tried old "comment out , see if works" trick, , i've found lines seem causing problem are:
uilabel *label; label = (uilabel *)[cell viewwithtag:1]; label.text = [nsstring stringwithformat:@"%d", numerator[indexpath.row]];
within tableview:cellforrowatindexpath
method.
so seems it's not happy updating label text @ point, shame since label no without being updated.
should updating label work in method, or using wrong type of view?
Comments
Post a Comment