How to call UIViewController from segmented control on the Navigation bar of the DetailViewController in a SplitViewController template
Can you tell ..how to ca开发者_如何学Cll UIViewController from segmented control on the Navigation bar of the DetailViewController in a SplitViewController template
Well, after you place your segment control in your Navigation bar, you can call this method:
[segmentedControl addTarget:self action:@selector(callViewController:) forControlEvents:UIControlEventValueChanged];
Then, in your DetailViewController, add the method:
-(void) callViewController:(id)sender {
// ..
// You can alloc/init your UIViewController and call it here
}
Remember to add -(void) callViewController:(id)sender; in your .h file too.
Edit: note that all this code goes in your DetailViewController class, which is managing your SplitViewController's detail view.
精彩评论