Swift快速集成控件篇(自定义图片IUImageView)

Swift快速集成控件篇(自定义图片IUImageView)_第1张图片
带有删除的UIImageView.gif
  1. 代码创建

代码实现

      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.jianshu.com/p/0f950c180cb8

你可能感兴趣的:(Swift快速集成控件篇(自定义图片IUImageView))