Import Foundation
Import UIKit
Import Coregraphics
Extension uiview{
var left:cgfloat{
set{
var frame = Self.frame
frame.origin.x = newvalue
Self.frame = Frame
}
get{
Return self.frame.origin.x
}
}
var top:cgfloat{
set{
var frame = Self.frame
FRAME.ORIGIN.Y = newvalue
Self.frame = Frame
}
get{
Return SELF.FRAME.ORIGIN.Y
}
}
var right:cgfloat{
set{
var frame = Self.frame
frame.origin.x = Newvalue-frame.size.width
Self.frame = Frame
}
get{
return self.frame.origin.x + self.frame.size.width
}
}
var bottom:cgfloat{
set{
var frame = Self.frame
FRAME.ORIGIN.Y = Newvalue-frame.size.height
Self.frame = Frame
}
get{
return SELF.FRAME.ORIGIN.Y + self.frame.size.height
}
}
var centerx:cgfloat{
set{
Self.center = Cgpoint (X:newvalue, y:self.center.x)
}
get{
Return self.center.x
}
}
var centery:cgfloat{
set{
Self.center = Cgpoint (x:self.center.x, Y:newvalue)
}
get{
Return SELF.CENTER.Y
}
}
var width:cgfloat{
set{
var frame = Self.frame
Frame.size.width = newvalue
Self.frame = Frame
}
get{
Return Self.frame.size.width
}
}
var height:cgfloat{
set{
var frame = Self.frame
Frame.size.height = newvalue
Self.frame = Frame
}
get{
Return Self.frame.size.height
}
}
}
Swift Learning UIView extension Add new attribute Left,right,top,bottom,width,height,centerx,centery