@property(nonatomic, retain) UIView *maskView Available in iOS 8.0 and later.
The view’s alpha channel determines how much of the view’s content and background shows through. Fully or partially opaque pixels allow the underlying content to show through but fully transparent pixels block that content.
@property(nonatomic) UIEdgeInsets layoutMargins Available in iOS 8.0 and later.
Use this property so specify the desired amount of space (measured in points) between the edge of the view and any subviews. Auto layout uses your margins as a cue for placing content. For example, if you specify a set of horizontal constraints using the format string “|-[subview]-|”, the left and right edges of the subview are inset from the edge of the superview by the corresponding layout margins. When the edge of your view is close to the edge of the superview and thepreservesSuperviewLayoutMargins property is YES, the actual layout margins may be increased to prevent content from overlapping the superview’s margins.
The default margins are eight points on each side.
@property(nonatomic) BOOL preservesSuperviewLayoutMargins Available in iOS 8.0 and later.
When the value of this property is YES, the superview’s margins are also considered when laying out content. This margin affects layouts where the distance between the edge of a view and its superview is smaller than the corresponding margin. For example, you might have a content view whose frame precisely matches the bounds of its superview. When any of the superview’s margins is inside the area represented by the content view and its own margins, UIKit adjusts the content view’s layout to respect the superview’s margins. The amount of the adjustment is the smallest amount needed to ensure that content is also inside the superview’s margins.
The default value of this property is NO.
- (void)layoutMarginsDidChange Available in iOS 8.0 and later.
The default implementation of this method does nothing. Subclasses can override this method and use it to respond when the value in the view’s layoutMargins property changes. For example, you might override this method if your view subclass handles layout manually or uses the layout margins during drawing. In both cases, you could use this method to initiate a drawing or layout update.
本文深入探讨了iOS开发中关键属性的理解与应用:maskView用于调整视图透明度,layoutMargins和preservesSuperviewLayoutMargins用于精确控制视图与子视图之间的间距,以及layoutMarginsDidChange方法的使用场景。
219

被折叠的 条评论
为什么被折叠?



