有没有什么方法可以为 iphone 5 定义框架,以便 iphone 6 和 6 plus 在不使用 xib 的情况下自动采用和调整它?
我不想为 iphone 6 和 iphone 6 plus 定义不同的框架。
有没有什么方法可以为 iphone 5 定义框架,以便 iphone 6 和 6 plus 在不使用 xib 的情况下自动采用和调整它?
我不想为 iphone 6 和 iphone 6 plus 定义不同的框架。
您可以使用 AutoLayout 和 Size 类为所有设备制作一个 UI。 尺寸等级 设计帮助
对于 Swift 语言,您可以使用:
let screenSize: CGRect = UIScreen.mainScreen().bounds
let screenWidth = screenSize.width;
let screenHeight = screenSize.height;
对于目标 C,您可以使用:
[[UIScreen mainScreen] bounds].size.width : For Width
[[UIScreen mainScreen] bounds].size.height : For Height