iphone - 方向iOS Storyboard不旋转?

标签 iphone objective-c ios ipad

好的,这可能很菜鸟,但我找不到解决方法。
我将 iPad UIViewController 拖到 Storyboard 并启用方向为 YES。但由于某种原因,该 View 没有旋转。顶部的状态栏正在旋转,但当您旋转 iPad 时,内部的 View 、表格 View 和标签不会旋转。任何人都知道为什么以及如何解决它?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOr‌​ientation { return YES; } 

最佳答案

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        //return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
        if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)) {
           //implement your code 
        return (interfaceOrientation != UIInterfaceOrientationLandscapeRight);
    } else {

        return YES;
    }
}

我想这会对你有所帮助。

关于iphone - 方向iOS Storyboard不旋转?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10732903/

相关文章:

iphone - 如何通过iPhone中的GPS位置管理器计算平均海拔

ios - 在 completionblock 中无法更改 UILabel 文本

ios - Swift 是否可以为 MKLocalSearchRequest 和 MKLocalSearchResponse 设置一个特定的国家

php - 适用于 iOS 的 Google 云消息传递 MismatchSenderId

iphone - 移动 CSS - 导航未出现

iphone - 如何在 iPhone 构建阶段将文件复制到库或文档目录?

ios - 如何从 Objective C 项目 App Delegate 调用 Swift?

ios - 从 IntPtr 句柄获取 Xamarin.iOS NSObject(新的或缓存的)

ios - 从 TableView 中检索值

iphone - ios在用户之间共享数据