【问题标题】:iPad App Landscape Mode broken iOS 8.3iPad App横向模式破坏iOS 8.3
【发布时间】:2015-06-25 13:29:17
【问题描述】:

我有一个适用于 iPad 的应用程序,该应用程序只是横向左右方向..就像打印屏幕:

我正在使用以下代码将视图旋转为横向模式:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
 CGAffineTransform rotate = CGAffineTransformMakeRotation(M_PI/2);
    [self.window setTransform:rotate];
    [self.window setFrame:CGRectMake(0, 0, 768, 1024)];
}

和xib:

它运行良好..但现在在 iOS 8.3 中它不起作用。看起来不对……看图:

【问题讨论】:

    标签: ios objective-c iphone ipad


    【解决方案1】:

    为您的 viewController 对象设置自动布局约束。 并且无需在 didFinishLaunchingWithOptions 中编写您的代码

    [[UIApplication sharedApplication]setStatusBarOrientation:UIInterfaceOrientationLandscapeRight];
     CGAffineTransform rotate = CGAffineTransformMakeRotation(M_PI/2);
     [self.window setTransform:rotate];
     [self.window setFrame:CGRectMake(0, 0, 768, 1024)];
    

    【讨论】:

    • 并在 xib 中设置方向横向和宽度 1024 高度 768?
    • [self.window setFrame:[[UIScreen mainScreen]bounds]];
    猜你喜欢
    • 2015-11-11
    • 1970-01-01
    • 1970-01-01
    • 2012-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多