当按钮被按下时它会起作用。点击后,此函数将显示另一个视图。
@IBAction func charSetPressed(_ button: UIButton) {
if button.titleLabel!.text == "1/2" {
charSet1.isHidden = true
charSet2.isHidden = false
button.setTitle("2/2", for: .normal)
} else if button.titleLabel!.text == "2/2" {
charSet1.isHidden = false
charSet2.isHidden = true
button.setTitle("1/2", for: .normal)
}
UIView.animateWithDuration(0.2, animations: {
button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 2.0, 2.0)
}, completion: {(_) -> Void in(here the error happend)
button.transform =
CGAffineTransformScale(CGAffineTransformIdentity, 1, 1)
})
}