Blazej SLEBODA
Blazej SLEBODA

Reputation: 9925

UITableView reloadData with performSelectorInBackground

An App interface has an UISegmentedControl on the top of screen and a UITableView of the rest of the screen.

When UiSegmentedControl gets a click then NSFetchedController gets an update for NSPredicate of NSFetchRequest and perform a performFetch method.

Because, it's take a 4 seconds to take a result I would like to reload a tableview to display 0 sections and after the result is ready then reload a tableView.

how to do it ?

Upvotes: 0

Views: 150

Answers (1)

Bhavesh Nayi
Bhavesh Nayi

Reputation: 3656

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self performSelectorInBackground:@selector(exercisedata) withObject:nil];

}


-(void)exercisedata
{
    [self performSelectorOnMainThread:@selector(ProcessComplete) withObject:nil waitUntilDone:NO];
}
-(void)ProcessComplete
{
    [tbl reloadData];
}

Upvotes: 1

Related Questions