iphone - ios 6.0 及更高版本中的方向问题

标签 iphone ios6 uiinterfaceorientation

我正在开发一个应用程序,其中一个 UIViewController 中有许多 UIView。现在的问题是,所有 UIView 都处于横向模式,这里只有一个 UIView 处于纵向模式。我无法使用 shouldAutorotate 方法获得此特定输出。

任何人都可以建议我具体的方法来解决这个问题。

最佳答案

@pratik-bhiyani 谢谢... 但我已经完成了这种代码,以在需要旋转 View 时获取特定代码

- (IBAction)btnClickToRedeem:(id)sender
{
    isPortraitRqurd = TRUE;
    [self shouldAutorotate];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    if(isPortraitRqurd)
        return (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
    else
        return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);

}

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    if(isPortraitRqurd)
        return UIInterfaceOrientationMaskPortrait;
    else
        return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    if(isPortraitRqurd)
    {
        return UIInterfaceOrientationPortrait;
        isPortraitRqurd = FALSE;
    }

    else
        return UIInterfaceOrientationLandscapeRight;
}

关于iphone - ios 6.0 及更高版本中的方向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16271573/

相关文章:

ios - 日期选择器选择的覆盖在屏幕旋转时不调整

objective-c - upSideDown iPhone 方向在 iOS 6 中不起作用?

iOS 8 方向错误。适用于 7.1

iphone - 我将如何使用 MapKit 在带有邮政编码/邮政编码的商店上放置图钉

iphone - xcode 无法编译 iOS 应用程序,在打开 .xib 或 .storyboard 文件时崩溃

iphone - 管理当前位置的缺失

iphone - UITableViewCell 错误 - 此类与键的键值编码不兼容

iphone - iOS 6 facebook sdk 3.1.1登录错误

objective-c - 用于创建 iOS Photostream 相册的 API

ios - Objective C语法理解