我有一个按钮,点击后应该更换图片,但由于某些原因它没有更换为UIControlState.Highlighted状态下设置的图片。
override func viewDidLoad() {
super.viewDidLoad()
let versusButtonClickedImage = UIImage(named: "versus_button_cicked") as UIImage
let versusButtonImage = UIImage(named: "versus_button") as UIImage
versusButton.setImage( versusButtonImage, forState: UIControlState.Normal)
versusButton.setImage(versusButtonClickedImage, forState: UIControlState.Highlighted)
}
as UIImage
部分是不必要的。 - ThomasWUIImage(named: "versus_button.png")
- Kumar KL