我想通过转动按钮上的两个图像来应用动画效果.我已应用以下代码但无法看到动画效果. 我已正确应用IBOutlets. var image1:UIImage = UIImage(named: "img_mic_off")! var image2:UIImage = UIImage(named: "img_m
我已正确应用IBOutlets.
var image1:UIImage = UIImage(named: "img_mic_off")! var image2:UIImage = UIImage(named: "img_mic_on")! btnRecord.imageView?.animationImages = [image1,image1] btnRecord.imageView?.animationDuration = 1.0 btnRecord.imageView!.startAnimating()
请帮我解决为什么它不能使用这个给定代码的问题.提前致谢.
看看我做了什么.图像正在发生变化.所以我希望这是你真正需要的.var image1:UIImage = UIImage(named: "img_mic_off")! var image2:UIImage = UIImage(named: "img_mic_on")! btn.setImage(image1, forState: UIControlState.Normal) btn.imageView!.animationImages = [image1, image2] btn.imageView!.animationDuration = 1.0 btn.imageView!.startAnimating()