SwappingContainerView
public final class SwappingContainerView<CustomView, AccessoryView> : UIView where CustomView : UIView, AccessoryView : UIView
This container view is designed to hold two UIView
elements and arrange them in a horizontal or vertical axis.
It also allows to easily change the order of the views if needed.
-
Keys that specify a horizontal or vertical layout constraint between views.
See moreDeclaration
Swift
public enum Axis : Hashable
-
Keys that specify a distribution of the contained views.
See moreDeclaration
Swift
public enum Distribution : Hashable
-
The layout of the arranged subviews along the axis.
Declaration
Swift
public var distribution: Distribution { get set }
-
The distribution axis of the contained view.
Declaration
Swift
public var axis: Axis { get set }
-
The distance in points between the edges of the contained views.
Declaration
Swift
public var spacing: CGFloat { get set }
-
Preferred priority of the internal constraints.
Declaration
Swift
public var preferredPriority: UILayoutPriority { get set }
-
Contained accessory view.
Declaration
Swift
public var accessoryView: AccessoryView { get set }
-
Contained main view.
Declaration
Swift
public var customView: CustomView { get set }
-
Initializes and returns a newly allocated view object with the specified frame rectangle.
Declaration
Swift
public init(frame: CGRect, axis: Axis = .horizontal, distribution: Distribution = .accessoryFirst, spacing: CGFloat, preferredPriority: UILayoutPriority = .required)
Parameters
frame
The frame rectangle for the view, measured in points. The origin of the frame is relative
axis
The view distribution axis.
distribution
The layout of the arranged subviews along the axis.
spacing
The distance in points between the edges of the contained views.
preferredPriority
Preferred priority of the internal constraints. to the superview in which you plan to add it.
-
Initializes and returns a newly allocated view object with the specified frame rectangle.
Declaration
Swift
public override init(frame: CGRect)
Parameters
frame
The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it.
-
A Boolean value that indicates whether the receiver depends on the constraint-based layout system.
Declaration
Swift
public override class var requiresConstraintBasedLayout: Bool { get }
-
Updates constraints for the view.
Declaration
Swift
public override func updateConstraints()