Search code examples
iosmultithreadinguitableviewuiviewreloaddata

iOS - another thread needs to send reloadData to the mainthread


I got a separate thread that creates a UIView object, inserts it into the UITableView's data source and then call reloadData on the UITableView. However, since it is a separate thread, it cannot call reloadData directly, it needs to make the mainthread do it... but how do you tell the mainthread to do it?

Thanks


Solution

  • [self.tableView performSelectorOnMainThread:@selector(reloadData)
                                     withObject:nil
                                  waitUntilDone:NO];