【问题标题】:UISplitViewController on iPhone 6 PlusiPhone 6 Plus 上的 UISplitViewController
【发布时间】:2015-07-03 10:46:32
【问题描述】:

我在 iPhone 和 iPad 上制作了一个应用程序。我有UISplitViewController,我在 iPad 上使用它。当我在 iPhone 6 Plus(模拟器)上启动我的应用程序时,UISplitViewController 不起作用。 (在 iPad 3 或 iPad Air 2 和 iPhone 5s 上效果很好)。我在我的代码中添加了以下内容。

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
    if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
        performSegueWithIdentifier("showDetailParse", sender: nil)
    } else if (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
        performSegueWithIdentifier("showParse", sender: nil)
    }
}

我的 iPad 屏幕运行良好

我的 iPhone 6 Plus 屏幕(模拟器)

更新: 我更新了我的代码,它定义了它在哪个设备上工作并且它确实工作了!在代码中,我定义了当前设备的高度,如果大于 2000 像素,我对 iPad 使用 segue。但我不喜欢这个解决方案。有什么想法吗?

我的更新代码如下。

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
    var screen = UIScreen.mainScreen().currentMode?.size.height
    if (UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad) || screen >= 2000 && UIDevice.currentDevice().orientation.isLandscape == true {
        performSegueWithIdentifier("showDetailParse", sender: nil)
    } else if (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
        performSegueWithIdentifier("showParse", sender: nil)
    }
}

【问题讨论】:

    标签: swift interface uisplitviewcontroller iphone-6-plus


    【解决方案1】:

    根据我在您提供的屏幕上看到的内容 - 您已在 MasterViewController 中嵌入了 UITabBarController。我以前也这样做过,诀窍是不要忘记您推动的位置 - 不要在 UINavigationController 中,因为那不是大师,大师是 UITabBarController

    我这样做了:

    self.tabBarController?.performSegueWithIdentifier("showDetail", sender: nil)
    

    这对我来说很适合这个故事板布局:

    【讨论】:

      猜你喜欢
      • 2015-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-19
      相关资源
      最近更新 更多