2

我有一个iPhone应用程序,它可以在人像中工作。当iphone变成风景时,呈现风景中的模式视图控制器

这个应用程序有一个导航视图控制器和rootViewcontroller它也是以纵向显示。当iPhone转向横向时,我想提供一个viewController,并在应用程序转为纵向时关闭此视图控制器。

目前我已经实现了这一点,但我的看法是完全移动:

第一步: Step1

第二步:

Step2

第三步: Step3

我试了事情,但我没有知道如果我选择正确的方式:

-(BOOL)shouldAutorotate 
{ 
    return YES; 
} 

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation  duration:(NSTimeInterval)duration 
{ 


} 

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 
{ 
    if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight) { 
     UIStoryboard *currentStoryboar = [self storyboard]; 
     ASTBigProgressViewController *bigProgress = [currentStoryboar instantiateViewControllerWithIdentifier:@"ASTBigProgressViewController"]; 
     [self presentViewController:bigProgress animated:YES completion:^{ 

     }]; 
    } 
} 
-(NSUInteger)supportedInterfaceOrientations 
{ 
    return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | 
      UIInterfaceOrientationMaskLandscapeRight |  UIInterfaceOrientationMaskPortraitUpsideDown); 
} 

我想,当视图控制器开启,它不会把它保持在同一位置的观点。我想:

-(BOOL)shouldAutorotate 
{ 
    return NO; 
} 

但显然didRotateFromInterfaceOrientation方法不叫。

有什么想法?

回答

0

关于Creating an Alternate Landscape Interface的Apple文档可能就是您要找的内容。

+0

感谢您的回答,我在这方面工作,而且工作得越来越好。只是我有问题,景观模式视图出现在视图的右侧,而不是从底部。 – xarly

+0

最后,我使用了这种方式,并使用modalTransitionStyle = UIModalTransitionStyleCrossDissolve解决了右侧动画的问题; – xarly

0

难道不存在或解雇在旋转过程中一个视图控制器,这是内viewWillRotateRotat和viewDidRotate ...和shouldViewRotate等

你可以使用performSelector:withDelay。即使是0.0或0.01的短暂延迟也应该这样做。

+0

感谢您的回答,我认为,这是一个很好的答案,但太诡计了,不是吗?我的意思是,取决于延迟不是很准确。 – xarly

+0

没错。首先,短暂的延迟肯定会将旋转过程从你的现在和离职中分离出来,但这不是很准确。您可能想要添加一些研究并寻找一个好的方法来挂钩。但是,您可能仍然需要将其延迟0分离。 –