UIView
class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate
-
Create a magic constraint in order to fix size
Declaration
Swift
public func defineSize(width: CGFloat, height: CGFloat)Parameters
widthwidth
heightheight
-
Create a magic constraint in order to fix height
Declaration
Swift
public func setHeight(height: CGFloat)Parameters
heightheight
-
Create a magic constraint in order to fix width
Declaration
Swift
public func setWidth(width: CGFloat)Parameters
widthwidth
-
Create a magic constraint in order to set min width
Declaration
Swift
public func setMinWidth(width: CGFloat)Parameters
widthmin width
-
Create a magic constraint in order to set max width
Declaration
Swift
public func setMaxWidth(width: CGFloat)Parameters
widthmax width
-
Create a magic constraint in order to set min height
Declaration
Swift
public func setMinWidth(height: CGFloat)Parameters
heightmin height
-
Create a magic constraint in order to set max height
Declaration
Swift
public func setMaxWidth(height: CGFloat)Parameters
heightmax height
-
Remove all magic contraints from owner view
Declaration
Swift
open func removeAllMagicConstraints() -
Create all related NSLayoutConstraint for the view and all subviews in cascade mode
Declaration
Swift
open func applyMagicConstrains()
-
Create a magic constraint in order to center the view horizontally to super view
Declaration
Swift
public func centerHorizontally(to container: UIView? = nil)Parameters
containerif you want to related the center to another view use container (if you don’t want to center to the parent view)
-
Create a magic constraint in order to center the view vertically to super view
Declaration
Swift
public func centerVertically(to container: UIView? = nil)Parameters
containerif you want to related the center to another view use container (if you don’t want to center to the parent view)
-
Create a magic constraint in order to center the view vertically & horizontally to super view
Declaration
Swift
public func center(to container:UIView? = nil)Parameters
containerif you want to related the center to another view use container (if you don’t want to center to the parent view)
-
Create a magic constraint in order to match the view width to super view width
Declaration
Swift
public func matchWidth(toView otherView: UIView? = nil, withPercentage percent: CGFloat = 100)Parameters
otherViewif you want to related the match to another view use container (if you don’t want to center to the parent view).
percentuse this parameter if you want to match with percent of the related view size, equals is 100
-
Create a magic constraint in order to match the view height to super view height
Declaration
Swift
public func matchHeight(toView otherView: UIView? = nil, withPercentage percent: CGFloat = 100)Parameters
otherViewif you want to related the match to another view use container (if you don’t want to center to the parent view).
percentuse this parameter if you want to match with percent of the related view size, equals is 100
-
Create a magic constraint in order to match the view height & width to super view height & width
Declaration
Swift
public func matchSize(toView view:UIView? = nil, withPercentage percentage: CGFloat = 100)Parameters
viewif you want to related the match to another view use container (if you don’t want to center to the parent view).
percentuse this parameter if you want to match with percent of the related view size, equals is 100
-
Undocumented
Declaration
Swift
open var leftPadding: CGFloat { get } -
Undocumented
Declaration
Swift
open var rightPadding: CGFloat { get } -
Undocumented
Declaration
Swift
open var topPadding: CGFloat { get } -
Undocumented
Declaration
Swift
open var bottomPadding: CGFloat { get } -
Create a magic constraint in order to add left padding to the view
Declaration
Swift
open func setLeftPadding(padding: CGFloat)Parameters
paddingvalue of padding
-
Create a magic constraint in order to add right padding to the view
Declaration
Swift
open func setRightPadding(padding: CGFloat)Parameters
paddingvalue of padding
-
Create a magic constraint in order to add top padding to the view
Declaration
Swift
open func setTopPadding(padding: CGFloat)Parameters
paddingvalue of padding
-
Create a magic constraint in order to add bottom padding to the view
Declaration
Swift
open func setBottomPadding(padding: CGFloat)Parameters
paddingvalue of padding
-
Create a magic constraint in order to add paddings to the view
Declaration
Swift
open func setPaddings(left: CGFloat, right: CGFloat, top: CGFloat, bottom: CGFloat)Parameters
leftvalue of left padding
rightvalue of right padding
topvalue of top padding
bottomvalue of bottom padding
-
Create a magic constraint in order to add paddings to the view
Declaration
Swift
open func setPadding(padding: CGFloat)Parameters
paddingvalue of left,right,top & bottom padding
-
Create a magic constraint in order to pin view to another view
Declaration
Swift
public func pin(to otherView: UIView? = nil, withMargin margin: CGFloat = 0 )Parameters
otherViewview to be pinned to
marginvalue of margin
-
Create a magic constraint in order to pin view’s left side to another view’s left side
Declaration
Swift
public func pinLeft(to otherView: UIView? = nil, withMargin margin: CGFloat = 0 )Parameters
otherViewview to be pinned to
marginvalue of margin
-
Create a magic constraint in order to pin view’s right side to another view’s right side
Declaration
Swift
public func pinRight(to otherView: UIView? = nil, withMargin margin: CGFloat = 0 )Parameters
otherViewview to be pinned to
marginvalue of margin
-
Create a magic constraint in order to pin view’s top side to another view’s top side
Declaration
Swift
public func pinTop(to otherView: UIView? = nil, withMargin margin: CGFloat = 0 )Parameters
otherViewview to be pinned to
marginvalue of margin
-
Create a magic constraint in order to pin view’s bottom side to another view’s bottom side
Declaration
Swift
public func pinBottom(to otherView: UIView? = nil, withMargin margin: CGFloat = 0 )Parameters
otherViewview to be pinned to
marginvalue of margin
-
Create a magic constraint in order to pin last subview’s bottom side to view’s bottom side
Declaration
Swift
public func pinLastSubviewToBottom(withMargin margin: CGFloat = 0 )Parameters
marginvalue of margin
-
Create a magic constraint in order to pin first subview’s top side to view’s top side
Declaration
Swift
public func pinFirstSubviewToTop(view: UIView, withMargin margin: CGFloat = 0 )Parameters
marginvalue of margin
-
Create a magic constraint in order to put view below of another view
Declaration
Swift
public func put(belowOf view: UIView, withMargin margin: CGFloat = 0)Parameters
viewrelated view
marginvalue of margin
-
Create a magic constraint in order to put view on bottom of another view’s last subview
Declaration
Swift
public func put(onBottomOfLastViewOf view: UIView, withMargin margin: CGFloat = 0)Parameters
viewrelated view
marginvalue of margin
-
Create a magic constraint in order to put view above of another view
Declaration
Swift
public func put( aboveOf view: UIView, withMargin margin: CGFloat = 0)Parameters
viewrelated view
marginvalue of margin
-
Create a magic constraint in order to put view left of another view
Declaration
Swift
public func put(leftOf view: UIView, withMargin margin: CGFloat = 0, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal)Parameters
viewrelated view
marginvalue of margin
-
Create a magic constraint in order to put view right of another view
Declaration
Swift
public func put(rightOf view: UIView, withMargin margin: CGFloat = 0, relation: NSLayoutConstraint.Relation = NSLayoutConstraint.Relation.equal)Parameters
viewrelated view
marginvalue of margin
View on GitHub
Install in Dash
UIView Extension Reference