ganesh
ganesh

Reputation: 1

How to call UIViewController from segmented control on the Navigation bar of the DetailViewController in a SplitViewController template

Can you tell ..how to call UIViewController from segmented control on the Navigation bar of the DetailViewController in a SplitViewController template

Upvotes: 0

Views: 405

Answers (1)

Tilo Mitra
Tilo Mitra

Reputation: 2793

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.

Upvotes: 1

Related Questions