- 代碼創(chuàng)建
代碼實現
var customImageView:CustomImageView?
var Cusvalue:Float=0.0
@IBAction func zhoubian(sender: AnyObject) {
Cusvalue+=0.1
//上傳進度
customImageView?.progress?.setProgress(Cusvalue, animated: true )
}
override func viewDidLoad() {
super.viewDidLoad()
customImageView = CustomImageView(frame: CGRectMake(50,400, 150, 150))
customImageView!.tag=111
customImageView!.customImageView?.image=UIImage(named: "J63MI042Z4P8.jpg")
customImageView!.deletebtn?.hidden=false //顯示當前刪除按鈕
customImageView!.deletebtn?.addTarget(self, action: #selector(HomeViewController.del(_:)), forControlEvents: .TouchUpInside)
self.view.addSubview(customImageView!)
}
func del(sender: UIButton){
print("我刪除了 ")
for view in self.view.subviews {
if view.tag==111 {
view.removeFromSuperview() //刪除
}
}
}
}
如需代碼余蟹,請移動到--->http://www.reibang.com/p/0f950c180cb8