当我尝试在Swift中创建按钮并设置背景图片时:
let button = UIButton.buttonWithType(UIButtonType.System) as UIButton
button.frame = CGRectMake(100, 100, 100, 100)
button.setImage(IMAGE, forState: UIControlState.Normal)
button.addTarget(self, action: "btnTouched:", forControlEvents: UIControlEvents.TouchUpInside)
self.view.addSubview(button)
我总是收到一个错误:“无法将表达式的类型'Void'转换为'UIImage' ”。
IMAGE
吗?