What is the basic difference between Auto Layout and Auto Resizing in iOS

前端 未结 4 453
挽巷
挽巷 2021-02-05 18:05

I have been searching the proper difference between Auto Layout and Auto Resizing, but didn\'t able to find the exact answer. Where I can use \"Auto Layout\" and where \"Auto Re

相关标签:
4条回答
  • 2021-02-05 18:32

    AutoResizing : Autoresizing means that how the content of a view will fit to the view. It probably depends on the self content of the view.

    AutoLayout: AutoLayout means how the external constraints like the position of the view , the size of view supported by the other neighboring components.

    AutoLayout triggers the AutoResizing Task and for autoresizing activity , auto-layout forcefully or normally change or break the default constraints of views which are related to the corresponding view if needed.

    0 讨论(0)
  • 2021-02-05 18:44

    I recommend watching the WWDC 2012 session https://developer.apple.com/videos/wwdc/2012/?id=202

    Auto Layout is a new way to define dynamic GUIs. Before, we had autoresizing masks, that described how a subview will resize or move when its superview is resized. With Auto Layout you can do the same and also a lot more complicated GUIs quite easily.

    Autoresizing is one of the most useful property for layouting the views in their hierarchies. go through this link.

    http://www.techpaa.com/2012/05/understanding-uiview-autoresizing.html

    0 讨论(0)
  • 2021-02-05 18:45

    Use autolayout in the superview with constraints [this helps when there are changes in the space in the View due to different devices(such as 3.5 or 4 inches retina)] and use autoresize for resizing the GUI objects in a view [this helps when there are changes in the space in the View during the orientation of the device]

    0 讨论(0)
  • 2021-02-05 18:50

    As Matt Neuburg states in his book:

    Autoresizing is a matter of conceptually assigning a subview “springs and struts.” A spring can stretch; a strut can’t. Springs and struts can be assigned internally or externally. Thus you can specify (using internal springs and struts) whether and how the view can be resized, and (using external springs and struts) whether and how the view can be repositioned.

    And

    Autolayout, depends on the constraints of views. A constraint (an instance of NSLayoutConstraint) is much more sophisticated than the "autoresizingMask" it’s a full-fledged object with numeric values, and can describe a relationship between any two views (not just a subview and its superview).

    0 讨论(0)
提交回复
热议问题