How to update the UITableView in the detail view when changing the scoreboard in the pop controller?

I am creating an iPad app with splitview, here is a screenshot, enter image description here In this case, I want to update the values ​​on the right side of the table when I change the tab in the masterview controller (left). What would be a good aproach, Should I load a different viewcontroller for each tab change? Is it possible? Or just refresh the table? For all tab changes, I want to display a table view with different data. I used the following code, I see changes in the log, but the table is not updated.

- (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { [_detailItem release]; _detailItem = [newDetailItem retain]; // Update the view. [self configureView]; } if (self.masterPopoverController != nil) { [self.masterPopoverController dismissPopoverAnimated:YES]; } } - (void)configureView { // Update the user interface for the detail item. if (isStudent) { textStr = @"student"; NSLog(@"Student....%@",textStr); [self.tableView reloadData]; }if (isTeachers) { textStr = @"teacher"; NSLog(@"Teacher....%@",textStr); [self.tableView reloadData]; }if (isPreference) { textStr = @"preference"; NSLog(@"Preference....%@",textStr); [self.tableView reloadData]; }if (isConfiguration) { textStr = @"configuration"; NSLog(@"Configuration....%@",textStr); [self.tableView reloadData]; } } 

I also tried

 [self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO]; 

Share your ideas. thanks:)

+7
source share
1 answer

I finally found this problem myself, and I was very good at finding a solution. I went through several forums and tutorials. Finally, I understood the question. And in this video, they demonstrated how to create a SplitView application using Xcode 4.2. In this, only one line of code fixed the problem. This is located in the Appdelegate.m file. By default, the MasterViewController does not have access to the detail view, so if we need to do something in the detail view, we must connect the masterviewcontroller and detailviewcontroller. Check out the video, then you (those facing the same problem) understand.

Thanks:)

+4
source

All Articles