
extension UIScrollVIEw { var hh_insetT : CGfloat { get { return contentInset.top } set(newVal) { var inset = contentInset inset.top = newVal contentInset = inset } } var hh_insetB : CGfloat { get { return contentInset.bottom } set(newVal) { var inset = contentInset inset.bottom = newVal contentInset = inset } } var hh_insetL : CGfloat { get { return contentInset.left } set(newVal) { var inset = contentInset inset.left = newVal contentInset = inset } } var hh_insetR : CGfloat { get { return contentInset.right } set(newVal) { var inset = contentInset inset.right = newVal contentInset = inset } } var hh_offsetX : CGfloat { get { return contentOffset.x } set(newVal) { var offset = contentOffset offset.x = newVal contentOffset = offset } } var hh_offsetY : CGfloat { get { return contentOffset.y } set(newVal) { var offset = contentOffset offset.y = newVal contentOffset = offset } } var hh_contentW : CGfloat { get { return contentSize.wIDth } set(newVal) { var size = contentSize size.wIDth = newVal contentSize = size } } var hh_contentH : CGfloat { get { return contentSize.height } set(newVal) { var size = contentSize size.height = newVal contentSize = size } }} UIVIEw-Extension extension UIVIEw { var hh_x : CGfloat { get { return frame.origin.x } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.origin.x = newVal frame = tmpFrame } } var hh_y : CGfloat { get { return frame.origin.y } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.origin.y = newVal frame = tmpFrame } } var hh_h : CGfloat { get { return frame.size.height } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.size.height = newVal frame = tmpFrame } } var hh_w : CGfloat { get { return frame.size.wIDth } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.size.wIDth = newVal frame = tmpFrame } } var hh_size : CGSize { get { return frame.size } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.size = newVal frame = tmpFrame } } var hh_origin : CGPoint { get { return frame.origin } set(newVal) { var tmpFrame : CGRect = frame tmpFrame.origin = newVal frame = tmpFrame } }} 总结 以上是内存溢出为你收集整理的Swift - 常用的扩展全部内容,希望文章能够帮你解决Swift - 常用的扩展所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)