简体   繁体   English

UINavigationController方向

[英]UINavigationController Orientation

I have UINavigationController with couple of view controller. 我有几个视图控制器的UINavigationController。 this is the list of them: Main -> Album -> image 这是它们的列表:Main-> Album-> image

Now in the first and the second(Main and album) i want that the UINavigationController will not rotate(only portrait), and in the third one(Image) it will be possible to rotate. 现在,在第一个和第二个(主要和专辑)中,我希望UINavigationController不旋转(仅纵向),而在第三个(图像)中可以旋转。

i made already category for the UINavigationController: 我已经为UINavigationController制作了类别:

-(BOOL)shouldAutorotate {
    if ([self.topViewController isKindOfClass:[MWPhotoBrowser class]]) {
        return YES;
    }
    return NO;
}

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
    if ([self.topViewController isKindOfClass:[MWPhotoBrowser class]]) {
        return YES;
    }
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

Now my problem is that when i push the image viewcontroller and the rotate the device (the viewcontroller rotate) and press back and here(Album) the viewcontroller is rotate to and can't rotate back to portrait. 现在我的问题是,当我按下图像视图控制器并旋转设备(视图控制器旋转)并按回去时,此处(相册)中的视图控制器将旋转到并且不能旋转回纵向。

By the way: i noticed it happen only in device with iOS 6 and iPhone 5 顺便说一句:我注意到它仅在装有iOS 6和iPhone 5的设备中发生

您是否尝试过包含以下方法,但为视图控制器返回正确的值?

- (NSUInteger)supportedInterfaceOrientations {

return UIInterfaceOrientationMaskPortraitUpsideDown;

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UINavigationController中的ViewController方向更改 - ViewController in UINavigationController orientation change 使用UITabbar的UINavigationController中的方向锁定 - Orientation lock in UINavigationController with UITabbar UINavigationController工具栏和设备方向(旋转) - UINavigationController Toolbar and device orientation (rotation) IOS6中UINavigationController中的UIView方向 - UIView Orientation in UINavigationController in IOS6 UIViewController方向在UINavigationController堆栈中发生变化 - UIViewController orientation changes in a UINavigationController stack UINavigationController,错误的背面 animation 方向 - UINavigationController, wrong back animation orientation UIDavigationController推送后[UIDevice currentDevice] .orientation == UIDeviceOrientationUnknown - [UIDevice currentDevice].orientation == UIDeviceOrientationUnknown following UINavigationController push 如何在UINavigationController rootViewController上禁用纵向方向 - How to disable portrait orientation on UINavigationController rootViewController UINavigationController + UITableViewController 在横向方向的返回转换错误 - Back Transition Wrong in UINavigationController + UITableViewController in Landscape Orientation 由于方向/摇晃,UINavigationController 加载视图不正确 - UINavigationController loading view incorrectly due to Orientation/Shake
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM