开发者

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

开发者 https://www.devze.com 2022-12-26 10:53 出处:网络
Can you tell ..how to ca开发者_如何学Cll UIViewController from segmented control on the Navigation bar of the DetailViewController in a SplitViewController templateWell, after you place your segment c

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消