let imageview = UIImageView(frame: CGRectMake(10.0,10.0,100.0,100.0)) self.view.addSubview(imageview) imageview.backgroundColor = UIColor.yellowColor() imageview.image = UIImage(named: "normalImage") imageview.contentMode = UIViewContentMode.Center imageview.userInteractionEnabled = true imageview.hidden = false
// 实例化方法2 highlightedImage、highlighted属性 let imageview02 = UIImageView(image: UIImage(named: "normalImage"),highlightedImage: UIImage(named: "hightImage")) self.view.addSubview(imageview02) imageview02.backgroundColor = UIColor.greenColor() imageview02.frame = CGRectMake(10.0,120.0,100.0) imageview02.highlighted = true
// 实例化方法3 let imageview03 = UIImageView(image: UIImage(named: "normalImage")) self.view.addSubview(imageview03) imageview03.backgroundColor = UIColor.redColor() imageview03.frame = CGRectMake(0.0,0.0,100.0) imageview03.center = CGPointMake(CGRectGetWidth(self.view.bounds) / 2,CGRectGetHeight(self.view.bounds) / 2) // 动画图片属性 imageview03.animationDuration = 1 imageview03.animationRepeatCount = 0 imageview03.animationImages = [UIImage(named: "normalImage")!,UIImage(named: "hightImage")!] imageview03.startAnimating()
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。