UIView Flashcards
init(frame: CGRect)
Initializes and returns a newly allocated view object with the specified frame rectangle.
var backgroundColor: UIColor?
The view’s background color.
var IsHidden: Bool
A Boolean value that determines whether the view is hidden.
var alpha: CGFloat
The view’s alpha value.
var IsOpaque: Bool
A Boolean value that determines whether the view is opaque.
var TintColor: UIColor!
The first nondefault tint color value in the view’s hierarchy, ascending from and starting with the view itself.
var tintAdjustmentMode: UIView.TintAdjustmentMode
The first non-default tint adjustment mode value in the view’s hierarchy, ascending from and starting with the view itself.
var clipsToBounds: Bool
A Boolean value that determines whether subviews are confined to the bounds of the view.
var clearsContextBeforeDrawing: Bool
A Boolean value that determines whether the view’s bounds should be automatically cleared before drawing.
var mask: UIView?
An optional view whose alpha channel is used to mask a view’s content.
class var layerClass: AnyClass
Returns the class used to create the layer for instances of this class.
var layer: CALayer
The view’s Core Animation layer used for rendering.
var isUserInteractionEnabled: Bool
A Boolean value that determines whether user events are ignored and removed from the event queue.
var isMultipleTouchEnabled: Bool
A Boolean value that indicates whether the view receives more than one touch at a time.
var isExclusiveTouch: Bool
A Boolean value that indicates whether the receiver handles touch events exclusively.
var frame: CGRect
The frame rectangle, which describes the view’s location and size in its superview’s coordinate system.
var bounds: CGRect
The bounds rectangle, which describes the view’s location and size in its own coordinate system.
var center: CGPoint
The center point of the view’s frame rectangle.
var transform: CGAffineTransform
Specifies the transform applied to the view, relative to the center of its bounds.
var superview: UIView?
The receiver’s superview, or nil if it has none.
var subviews: [UIView]
The receiver’s immediate subviews.
var window: UIWindow?
The receiver’s window object, or nil if it has none.
func addSubview(UIView)
Adds a view to the end of the receiver’s list of subviews.
func bringSubViewToFront (UIView)
Moves the specified subview so that it appears on top of its siblings.
func sendSubviewToBack (UIView)
Moves the specified subview so that it appears behind its siblings.
func removeFromSuperview()
Unlinks the view from its superview and its window, and removes it from the responder chain.
func insertSubView(UIView, at: Int)
Inserts a subview at the specified index.
func insertSubView(UIView, above Subview: UIView)
Inserts a view above another view in the view hierarchy.
func insertSubview(UIView, below Subview: UIView)
Inserts a view below another view in the view hierarchy.
func exchangeSubview(at: Int, with SubviewAt: Int)
Exchanges the subviews at the specified indices.
func isDescendant(of: UIView) -> Bool
Returns a Boolean value indicating whether the receiver is a subview of a given view or identical to that view.
func didAddSubview(UIView)
Tells the view that a subview was added.
func willRemoveSubview(UIView)
Tells the view that a subview is about to be removed.
func willMove(toSuperview: UIView?)
Tells the view that its superview is about to change to the specified superview.
func didMoveToSuperView()
Tells the view that its superview changed.
func willMove(toWindow: UIWindow?)
Tells the view that its window object is about to change.
func didMoveToWindow()
Tells the view that its window object changed.
var directionalLayoutMargins: NSDirectionalEdgeInsets
The default spacing to use when laying out content in a view, taking into account the current language direction.
var layoutMargins: UIEdgeInsets
The default spacing to use when laying out content in the view.
var preserveSuperviewLayoutMargins: Bool
A Boolean value indicating whether the current view also respects the margins of its superview.
func layoutMarginsDidChange()
Notifies the view that the layout margins changed.
var safeAreaInsets: UIEdgeInsets
The insets that you use to determine the safe area for this view.
var safeAreaLayoutGuide: UILayout Guide
The layout guide representing the portion of your view that is unobscured by bars and other content.
func safeAreaInsetsDidChange()
Called when the safe area of the view changes.
var insetsLayoutMarginsFromSafeArea: Bool
A Boolean value indicating whether the view’s layout margins are updated automatically to reflect the safe area.
var constraints: [NSLayout Constraint]
The constraints held by the view.
func addConstraint (NSLayout Constraint)
Adds a constraint on the layout of the receiving view or its subviews.
func addConstraints([NSLayout Constraint])
Adds multiple constraints on the layout of the receiving view or its subviews.
func removeConstraint(NSLayout Constraint)
Removes the specified constraint from the view.
func removeConstraints([NSLayout Constraints])
Removes the specified constraints from the view.