ios - UITableView's reloadData sometimes does not call numberOfRowsInSection -
[tableview reloaddata]
not call numberofrowsinsection:(nsinteger)section
what write answer in stackoverflow if saw question this:
- be sure delegate , datasource connected perfectly.
- just in case check if calling main thread or not.
i tried answers before asking question.
i put following line in mytableview class (extended uitableview)
- (void)reloaddata{ nslog(@"mytableview (reloaddata) self.datasource: %@, delegate: %@, ismainthread: %d",self.datasource,self.delegate,[nsthread ismainthread]); [super reloaddata]; [self.delegate performselector:@selector(tablereloaded:) withobject:self]; }
i see called mainthread , datasource , delegate never nil.
i not curious why tableview not call cellforrow first has call numberofrows see if result > 0. however, doesn't call numberofrows too...
any ideas? can reason tableview giveup calling numberofrows function?
update: i've put new lines reloaddata function print fullstack see if being called tableview's own functions. result: called outside of tableview there shouldn't unexpected behaviour.
update2: "sometimes": have discovered problem after users started "sometimes" don't see changes in table. after that, tried hit run button in xcode continuouslly until app opens bug. (30% percentage of runs shows bug). when happens, until restart application, reloaddata never works again.
update3: put self.datasource==myexpectedviewcontroller
, [self.datasource tableview:self numberofrowsinsection:0]
see if delegates not nil maybe being cloned etc.. result true , numberofrows correctly returning>0. delegates correct , have more items zero.
update4: tried fresh uitableview (removing custom uitableview), got same results.
update5: i've put button on screen recreates table , sets delegates. whenever problem in question happens, hit button , starts work perfectly. so, there must breaks internals of uitableview invalidates every call reloaddata, still couldn't find it.
Comments
Post a Comment