我UIButton在ios中创建了一个自定义。我想使用相同的自定义按钮十次,它们具有相同的属性但标题不同。在不为每个按钮重复相同代码的情况下,最有效,最聪明的方法是什么?它应该是结构还是类还是其他?我该如何实施?我为自定义按钮更改的属性如下:
@IBOutlet weak var button_1: UIButton!
button_1.frame = CGRectMake(0.0, 0.0, button_1.frame.width, button_1.frame.height)
button_1.clipsToBounds = true
button_1.layer.cornerRadius = button_1.frame.width/2.0
button_1.layer.borderColor = UIColor.whiteColor().CGColor
button_1.layer.borderWidth=2.0
Run Code Online (Sandbox Code Playgroud)