【发布时间】:2015-11-29 06:29:35
【问题描述】:
func createButtonWithTitle(title: String) -> UIButton {
let button = UIButton.buttonWithType(.System) as UIButton
button.frame = CGRectMake(0, 0, 20, 20)
button.setTitle(title, forState: .Normal)
button.sizeToFit()
button.titleLabel.font = UIFont.systemFontOfSize(15)
button.setTranslatesAutoresizingMaskIntoConstraints(false)
button.backgroundColor = UIColor(white: 1.0, alpha: 1.0)
button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
button.addTarget(self, action: "didTapButton:", forControlEvents: .TouchUpInside)
return button
}
在UIButton 之前的第 1 行引发错误。
我该如何解决?
【问题讨论】:
-
什么意思?!只需将
-&t;更改为->就可以了!这只是一个错字!我猜你是从网上复制的文字。