/ Published in: Other
UIView Extension that allow to set/get x,y,width,height in ActionScript 3.0
myView.x =30;
myView2.x = myView.x;
myTextField.x = 30;
myView.x =30;
myView2.x = myView.x;
myTextField.x = 30;
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Save as UIViewExtension import UIKit extension UIView { var x: CGFloat { get { return self.frame.origin.x; } set { var rect : CGRect = self.frame; rect.origin.x = newValue; self.frame = rect; } } var y: CGFloat { get { return self.frame.origin.y; } set { var rect : CGRect = self.frame; rect.origin.y = newValue; self.frame = rect; } } var width: CGFloat { get { return self.frame.width; } set { var rect : CGRect = self.frame; rect.size.width = newValue; self.frame = rect; } } var height: CGFloat { get { return self.frame.height; } set { var rect : CGRect = self.frame; rect.size.height = newValue; self.frame = rect; } } }