iOS的自动版式VS弹簧与放大器;支柱 [英] iOS AutoLayout vs Springs & Struts
问题描述
你好,亲爱的社区!
一年前,我已经看到了关于自动布局的好处,但夫妇苹果的WWDC presentations的尝试时,在现实世界中的项目,这种情况下,当你在一个故事板还可以将一些UI元素微微一半打破限制从自动消失布局的所有好处。
A year ago I've seen couple of Apple WWDC presentations about benefits of Auto-Layout but when tried that in real-world project, that case when you move some UI element on a storyboard slightly and it breaks half of the constraints vanished all the benefits from Auto-Layout.
到现在我一直在利用弹簧与放大器; Struts的非常成功地,并与视图志愿观测框架路径一起处理了大部分旋转再比对与优雅code的只是几行。
Till now I've been utilising Springs & Struts quite successfully, and in conjunction with KVO observing 'frame' path for view handled most of rotation re-alignments gracefully with just couple lines of code.
所以,现在与iOS 7出来我有一个问题 - 我能保持成功利用弹簧和放大器;支柱针对iOS 7的应用程序或我这样做输给了?学习和掌握在不同情况下使用自动布局可能会需要几天来我的技能,所以我真的AP preciate一些argumented建议。
So now with iOS 7 coming out I got a question - can I keep successfully utilising springs & struts for iOS 7 apps or am I losing out by doing so? Learning and mastering skill of using auto-layout in different scenarios would probably take couple of days to me, so I'd really appreciate some argumented advice.
感谢您,
结果丹
Thank you,
Dan
解决:感谢马克斯的答案,我开始钻研自动布局;而空是正确的,他的答案 - 你其实可以用弹簧与放大器;在iOS 7的Struts没有太多的麻烦,自动布局是强大的。
RESOLVED: Thanks to Max's answer I started to dig into auto-layout; while Null is right in his answer - you actually can use Springs & Struts on iOS 7 without too much trouble, Auto-Layout is powerful.
显然,在X code 5以下的东西是固定的:
Apparently in XCode 5 the following things are fixed:
所以我的选择是自动布局。谢谢大家。
So my choice is Auto-Layout. Thank you everybody.
推荐答案
自动布局是未来,弹簧与放大器; Struts是过去。如果继续使用的弹簧与放大器; Struts的你将处于不利地位的新标准 - 自动布局 - 成为prevalent
Auto Layout is the future and Springs & Struts is the past. If you continue to use Springs & Struts you will be at a disadvantage as the new standard - Auto Layout - becomes prevalent.
另外,弹簧与放大器; Struts是不是有效的复杂视图。自动布局是相当强大。
Also, Springs & Struts isn't effective for complex views. Auto Layout is considerably more powerful.
与iOS 7,它的初期,虽然我不知道到底是什么含义是,在<一个href=\"https://developer.apple.com/library/$p$prelease/ios/documentation/UserExperience/Conceptual/TransitionGuide/index.html\"相对=nofollow>的iOS 7的用户界面过渡指南特别提到,使用自动布局将缓解转型过程:
With iOS 7, it's early days, and although I'm not sure exactly what the implications are, the iOS 7 UI Transition Guide specifically mentions that using Auto Layout will ease the transition process:
如果您的应用程序使用自动布局,你的工作更容易。在X code 5,自动布局可以帮助应用程序适应新的UI元素的指标,并适当在文本大小的动态变化。自动布局是特别有帮助的,如果你的转换iOS 6的应用程序,或者您需要同时支持iOS 6的和iOS 7。
If your app uses Auto Layout, your job is easier. In Xcode 5, Auto Layout can help an app accommodate new UI element metrics and respond appropriately to dynamic changes in text size. Auto Layout is particularly helpful if you’re transitioning an iOS 6 app or you need to support both iOS 6 and iOS 7.
如果您没有使用自动布局,现在可能是开始的最佳时机,
特别是如果你需要支持的应用程序的多个版本。如果
你使用手动或编程布局技术,你负责
为确保布局时适当文字大小调整
变化。
If you didn’t use Auto Layout, now may be the perfect time to start, especially if you need to support more than one version of an app. If you use manual or programmatic layout techniques, you're responsible for ensuring that the layout adjusts appropriately when text size changes.
就个人而言,我一直在使用自动布局由于X code 4.6.3。最初的学习曲线是痛苦的,但之后就真的成为一个欢乐的使用。我肯定永远不会回到弹簧与放大器; Struts或者使用框架如何计算指标。
Personally, I've been using Auto Layout since Xcode 4.6.3. The initial learning curve is painful, but after that it really becomes a joy to use. I'd definitely never go back to Springs & Struts or manually calculating metrics using frames.
这篇关于iOS的自动版式VS弹簧与放大器;支柱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!