2个不同的纵向和横向故事板

时间:2012-03-10 15:20:31

标签: ios xcode storyboard uistoryboard

是否可以创建2个故事板并根据设备方向访问每个故事板?我试过这段代码:

- (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"];

    }}

......但是不起作用?我正在犯的任何错误?

1 个答案:

答案 0 :(得分:2)

我认为this answer to a previous post (iPhone Storyboard: different scene for portrait and landscape)可能会解决您的问题。它解释了如何为纵向和横向模式设置不同的视图,但仍然使用相同的视图控制器。