是否可以创建 2 个 Storyboard并根据设备方向访问每个 Storyboard?我尝试了这段代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
if (UIInterfaceOrientationPortrait){
UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Storyboardland.storyboard"];
}else if (UIInterfaceOrientationPortraitUpsideDown){
UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MainStoryboard_iPad.storyboard"];
}}
...但不起作用?我犯了什么错误吗??
最佳答案
我认为this answer to a previous post (iPhone Storyboard: different scene for portrait and landscape)可能会解决你的问题。它解释了如何为纵向和横向模式提供不同的 View ,但仍然使用相同的 View Controller 。
关于ios - 2 个不同的纵向和横向 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9647548/