Why do my table view cells disappear when reloaded using reloadRowsAtIndexPaths?

后端 未结 12 1777
青春惊慌失措
青春惊慌失措 2021-02-02 12:20

I have a bare-bones sample project here:

http://dl.dropbox.com/u/7834263/ExpandingCells.zip

In this project, a UITableView has a custom UITableViewCell. In each

12条回答
  •  灰色年华
    2021-02-02 12:46

    When you use this method, you have to be sure that you are on the main thread. Refreshing a UITableViewCell as follow should do the trick :

    - (void) refreshTableViewCell:(NSNumber *)row
    {
        if (![[NSThread currentThread] isMainThread])
        {
            [self performSelector:_cmd onThread:[NSThread mainThread]  withObject:row waitUntilDone:NO];
            return;
        }
    
        /*Refresh your cell here
         ...
         */
    
    }
    

提交回复
热议问题