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
width
width
height
height
-
Create a magic constraint in order to fix height
Declaration
Swift
public func setHeight(height: CGFloat)
Parameters
height
height
-
Create a magic constraint in order to fix width
Declaration
Swift
public func setWidth(width: CGFloat)
Parameters
width
width
-
Create a magic constraint in order to set min width
Declaration
Swift
public func setMinWidth(width: CGFloat)
Parameters
width
min width
-
Create a magic constraint in order to set max width
Declaration
Swift
public func setMaxWidth(width: CGFloat)
Parameters
width
max width
-
Create a magic constraint in order to set min height
Declaration
Swift
public func setMinWidth(height: CGFloat)
Parameters
height
min height
-
Create a magic constraint in order to set max height
Declaration
Swift
public func setMaxWidth(height: CGFloat)
Parameters
height
max 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
container
if 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
container
if 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
container
if 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
otherView
if you want to related the match to another view use container (if you don’t want to center to the parent view).
percent
use 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
otherView
if you want to related the match to another view use container (if you don’t want to center to the parent view).
percent
use 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
view
if you want to related the match to another view use container (if you don’t want to center to the parent view).
percent
use 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
padding
value of padding
-
Create a magic constraint in order to add right padding to the view
Declaration
Swift
open func setRightPadding(padding: CGFloat)
Parameters
padding
value of padding
-
Create a magic constraint in order to add top padding to the view
Declaration
Swift
open func setTopPadding(padding: CGFloat)
Parameters
padding
value of padding
-
Create a magic constraint in order to add bottom padding to the view
Declaration
Swift
open func setBottomPadding(padding: CGFloat)
Parameters
padding
value 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
left
value of left padding
right
value of right padding
top
value of top padding
bottom
value of bottom padding
-
Create a magic constraint in order to add paddings to the view
Declaration
Swift
open func setPadding(padding: CGFloat)
Parameters
padding
value 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
otherView
view to be pinned to
margin
value 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
otherView
view to be pinned to
margin
value 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
otherView
view to be pinned to
margin
value 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
otherView
view to be pinned to
margin
value 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
otherView
view to be pinned to
margin
value 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
margin
value 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
margin
value 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
view
related view
margin
value 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
view
related view
margin
value 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
view
related view
margin
value 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
view
related view
margin
value 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
view
related view
margin
value of margin