我已经使用 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/