[英]Creating a replace segue to a detail view on iPad split screen programmatically
I've got the iPhone working fine with creating a segue programmatically. 我通过编程创建了一个iphone,使iPhone正常工作。 eg 例如
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone"
bundle:nil];
FooBarViewController *foobarViewController = (FooBarViewController *)[storyboard instantiateViewControllerWithIdentifier:@"foobarViewControllerID”];
[self.navigationController pushViewController:foobarViewController animated:YES];
Now I'm trying to do something similar on the iPad storyboard. 现在,我正在尝试在iPad故事板上执行类似的操作。 The goal being to programmatically change the detail view to a view on the storyboard. 目的是通过编程将详细信息视图更改为情节提要上的视图。 I thought maybe: 我想也许是:
[self.splitViewController.navigationController presentViewController:foorbarViewController animated:NO completion:nil];
However this doesn't work. 但是,这不起作用。 Any suggestions? 有什么建议么?
I believe I've solved my own question with the following function: 我相信我已经通过以下功能解决了自己的问题:
- (void) presentDetailView : (UIViewController *) viewcontroller {
UINavigationController *detailNavCtrl = [[UINavigationController alloc] initWithRootViewController:viewcontroller];
detailNavCtrl.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
detailNavCtrl.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[[[self.splitViewController viewControllers] lastObject] presentViewController:detailNavCtrl animated:NO completion:nil];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.