Xcode实时渲染——@IBDesignable

来源:互联网 发布:有了源码怎么架设游戏 编辑:程序博客网 时间:2024/05/22 05:51

在定义的参数前,添加IBDesignable,图片attributes inspector中就会出现相应的设置项,很方便于调试

import UIKit@IBDesignableclass FaceView: UIView {        @IBInspectable    var lineWidth: CGFloat = 3 {didSet{setNeedsDisplay()}} // Marks the receiver’s entire bounds rectangle as needing to be redrawn.    @IBInspectable    var color: UIColor = UIColor.blueColor(){didSet{setNeedsDisplay()}}        @IBInspectable    var scale: CGFloat = 0.90{didSet{setNeedsDisplay()}}}



0 0
原创粉丝点击