ios - 我如何判断 Springs 和 Struts 应用程序是否在 iPhone 6 模拟器中缩放?

标签 ios cocoa-touch ios8 iphone-6 iphone-6-plus

我在 iPhone 6 和 6 Plus 模拟器中试用了几个构建了预自动布局的应用程序(但使用 Springs 和 Struts 来支持 iPhone 5+),它们实际上看起来相当不错。然而,我无法判断 Springs 和 Struts 是否真的在做它们所谓的工作,或者它们是否只是被缩放。一定有一些明显的东西我错过了它说的是哪个?此外,自动布局应用程序是否会在使用最新的 iPhone 6 SDK 重新编译时自动转换,以便它们不只是缩放,只要提供 3X 图稿(在 6 Plus 的情况下)?

最佳答案

通过输出边界和主屏幕的 native 边界屏幕,您可以很容易地看到您的应用是否以缩放模式运行:

println("bounds = \(UIScreen.mainScreen().bounds)")
println("nativeBounds = \(UIScreen.mainScreen().nativeBounds)")

如果没有指定的启动图像,iPhone 6 Plus 模拟器的输出是:

bounds = (0.0,0.0,320.0,480.0)
nativeBounds = (0.0,0.0,960.0,1440.0)

原生边界是缩放边界的 3 倍。这就是 @3x display.scale 背后的原因。

对于 iPhone 6 Plus nativeScale 也有帮助:

println("main screen native scale = \(UIScreen.mainScreen().nativeScale)")
println("main screen scale = \(UIScreen.mainScreen().scale)")

nativeScale 将始终为 3.0。如果模拟器进行缩放,scale 将为 2.0

要全面了解新决议,请参阅这篇精彩的博客文章:http://www.paintcodeapp.com/news/iphone-6-screens-demystified

关于ios - 我如何判断 Springs 和 Struts 应用程序是否在 iPhone 6 模拟器中缩放?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25768497/

相关文章:

ios - 如何解决体系结构 x86_64 类型为 'sourcecode.module-map' 的问题 : no rule to process file/FBSDKCoreKit. 模块映射'

javascript - 使用 stringByEvaluatingJavaScriptFromString document.getElementsByClassName 从 UIWebView 获取数据

iphone - @synchronized(self) 有多少开销?

objective-c - 如何从 NSMutableArray 中只删除对象的一个​​实例?

objective-c - IB Inspector 窗口中 connection tap 下的 Outlets 和 Referencing Outlets 有什么区别?

ios8 TouchID 检测是否添加了指纹

ios - 容器 View 和容器 View Controller 有什么区别?

iphone - 调用 setEditing 时自定义 UITableViewCell 调整大小标签

ios - 呈现自定义模态视图时,如何在背景中显示 "fade out"控件的颜色?

objective-c - 这是在 iOS8 中获取文档目录路径的最佳方式