6
您好我有一个模式在iOS8中呈现ViewController的旋转问题。所有这些在iOS7和更低版本上都能正常工作。iOS8模态ViewController旋转问题
应用程序的结构:
- RootController(支持方向:纵向)
- 莫代尔主办视图控制器(支持方向:所有)
我的问题是,当我旋转设备时,模态控制器是呈现模态控制器的视图没有调整到lanscape框架。
看起来像这样:
的旋转的方法被称为当我手动设置的视图的帧为横向右侧(灰色屏幕侧)的用户交互没有工作。
RootController代码:
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger) supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
模态控制器代码:
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
if (self.presentingViewController != nil) {
[self.presentingViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation
duration:duration];
}
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
if (self.presentingViewController != nil) {
[self.presentingViewController willRotateToInterfaceOrientation:toInterfaceOrientation
duration:duration];
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if (self.presentingViewController != nil) {
[self.presentingViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
}
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
}];
}
任何一个可以帮助我解决这个问题iOS8上。
您是否在UI元素上设置了autoresizingMask? – Jasper 2014-11-27 17:19:22