7

I am creating an iPad app with splitview, here is the screen shot, enter image description here In this one, I want to update the values in the righthand side tableview, when I change the tab in the masterview controller (left hand side). Which will be the good aproach, Should I load another viewcontroller for each tab change? Is it possible? Or just update the table? For all the tab changes i want to display a tableview with different data. I used following code, i can see the changes in the log, but the table is not getting 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 am also tried

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

Please share your ideas. thanks :)

Community
  • 1
  • 1
Mithuzz
  • 1,091
  • 14
  • 43
  • i think I am not able to update any objects in the interface. I tried to update a UILabel, but I couldn't. But I can print the status changes in the NSLog. – Mithuzz Feb 17 '12 at 09:03

1 Answers1

4

At last I found the issue myself, and I was really great to search for a solution. I have went through several forums and tutorials. Finally I figured out the issue. And in this video, they have illustrated how to create a SplitView application using XCode 4.2. In this one, just one line of code fixed the issue. That is in the Appdelegate.m file. In default, the MasterViewController doesn't have access to the detail view, so if we need to do something on the detailview, we have to connect masterviewcontroller and detailviewcontroller. Check the video, then you will (those who are facing the same issue) understand.

Thanks :)

Mithuzz
  • 1,091
  • 14
  • 43