我有一个iPhone应用程序,它可以在人像中工作。当iphone变成风景时,呈现风景中的模式视图控制器
这个应用程序有一个导航视图控制器和rootViewcontroller
它也是以纵向显示。当iPhone转向横向时,我想提供一个viewController
,并在应用程序转为纵向时关闭此视图控制器。
目前我已经实现了这一点,但我的看法是完全移动:
第一步:
第二步:
第三步:
我试了事情,但我没有知道如果我选择正确的方式:
-(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
方法不叫。
有什么想法?
感谢您的回答,我在这方面工作,而且工作得越来越好。只是我有问题,景观模式视图出现在视图的右侧,而不是从底部。 – xarly
最后,我使用了这种方式,并使用modalTransitionStyle = UIModalTransitionStyleCrossDissolve解决了右侧动画的问题; – xarly