ios - 在 ios 中的 Xcode 6 中运行 Xcode 5 项目

标签 ios xcode6 xcode5.1

我已经使用 Xcode 5 创建了通用项目。现在如何在 Xcode 6 中运行这些项目。 也想升级 iPhone 6 和 iPhone 6 plus。

#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 667.0)
//#define IS_IPHONE_6PLUS (IS_IPHONE && [[UIScreen mainScreen] nativeScale] == 3.0f)
#define IS_IPHONE_6_PLUS (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 736.0)

最佳答案

不要将您的代码基于屏幕分辨率。应通过 respondsToSelector: 检测可用功能,UI 应使用自动布局完成,如果您需要对某些尺寸进行一些自定义,请使用 Xcode 中的尺寸类控件。如果您需要在代码中执行此操作,请使用 willTransitionToTraitCollection(:withTransitionCoordinator:) 找出将出现的尺寸类别。

请参阅 Apple 对尺寸等级的介绍 here

关于ios - 在 ios 中的 Xcode 6 中运行 Xcode 5 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26218032/

相关文章:

ios - 如何通过单击 ios 中的全选按钮来选择 tableview 单元格中的所有复选框按钮

swift - 使用 Swift 在 Xcode 6 中呈现来自 SKScene 的 View

ios - 核心数据 - countforfetch 总是为空数据库返回 1

swift - XCode 6-b3 (Swift) 中状态栏的颜色文本

ios - 在模拟器上卸载应用程序后未清除 NSUserDefaults

uitableview - Xcode 5.1 iOS 7.1 UITableView 中的单元格问题

cordova - 工作区完整性 : The file could't be opened Xcode 5

ios - 指向 maps.google.com 的 iPhone HTML 链接在 Mobile Safari 而非 Maps 应用程序中打开页面

ios - CapsPageMenu 隐藏 TableView 上的 NavigationBar 从子 UIViewController 滚动不工作

ios - TouchesBegan 在下一个 View Controller 中被识别