Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MACloop

macrumors 6502
Original poster
May 18, 2009
393
0
Germany
>>> I found a solution in the sample code from apple :)

Hello!
I have examined the UISplitViewController the last days and have a question. If I have a UISplitViewController defined with say a left and a right viewcontroller and I want to display different viewcontrollers in this rightviewcontroller. How do I do that correctly?

I have tried this which I found the idea for in a tutorial. The difference was in the tutorial, only a picture was displayed when clicking on one of the items in the leftSideViewController. But I thought it might be possible to add a viewcontroller view aswell...?
Code:
- (void)setDetailItem:(id)newDetailItem {
	if(detailItem != newDetailItem) {   
		[detailItem release]; 
		detailItem = [newDetailItem retain];   // Update the view.   
		navigationBar.topItem.title = detailItem;     
		NSString *viewNIBName = [NSString stringWithFormat:@"%@ViewController",detailItem];
		UIViewController *theCurrentDetailedView = [[UIViewController alloc]initWithNibName:viewNIBName bundle:nil];
		[self.theView addSubview:theCurrentDetailedView.view];
		[theCurrentDetailedView release];
	}     
	
	if (popoverController != nil) {   
		[popoverController dismissPopoverAnimated:YES];   
	}        
}


The problem is that the viewDidLoad method does not get fired in the viewcontroller. And the only things displayed on the screen are those defined in the xib file for this current viewController. So, I assume this is not the way to do it? I would like to let a click in one of the table cells in the leftViewController to open up different viewcontrollers and within these is the user supposed to make other actions using buttons within the current viewcontroller.

Any Ideas?
MACLoop
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.