                                                multiplier: 1.0,
                                                constant: 30))
         
-        activityView.addConstraint(NSLayoutConstraint(item: avimg,
+        superview.addConstraint(NSLayoutConstraint(item: image,
                                                       attribute: .right,
                                                       relatedBy: .equal,
-                                                      toItem: activityView,
+                                                      toItem: superview,
                                                       attribute: .right,
                                                       multiplier: 1.0,
                                                       constant: -18))
         
-        activityView.addConstraint(NSLayoutConstraint(item: avimg,
+        superview.addConstraint(NSLayoutConstraint(item: image,
                                                       attribute: .centerY,
                                                       relatedBy: .equal,
-                                                      toItem: activityView,
+                                                      toItem: superview,
                                                       attribute: .centerY,
                                                       multiplier: 1.0,
                                                       constant: 0))

extension EUHomeHeadView{
    
    fileprivate func setupActivityView(){
        
        
        
//        let avimgview = UIImageView(image: #imageLiteral(resourceName: "home_activity"))
//        activityView.addSubview(avimgview)
        
        let avtitle = UILabel()
        avtitle.text = "活动"
        avtitle.font = UIFont.boldSystemFont(ofSize: 16)
        avtitle.sizeToFit()
        avtitle.textColor = UIColor.white
        activityView.addSubview(avtitle)
        
        let avdetail = UILabel()
        avdetail.text = "活出精彩"
        avdetail.font = UIFont.boldSystemFont(ofSize: 15)
        avdetail.sizeToFit()
        avdetail.textColor = UIColor.white
        activityView.addSubview(avdetail)
        
        let avimg = UIImageView(image: #imageLiteral(resourceName: "home_activity"))
        activityView.addSubview(avimg)
        
        // 自动布局
        avdetail.translatesAutoresizingMaskIntoConstraints = false
        avtitle.translatesAutoresizingMaskIntoConstraints = false
        avimg.translatesAutoresizingMaskIntoConstraints = false
        
        activityView.addConstraint(NSLayoutConstraint(item: avtitle,
                                                      attribute: .top,
                                                      relatedBy: .equal,
                                                      toItem: activityView,
                                                      attribute: .top,
                                                      multiplier: 1.0,
                                                      constant: 6))
        
        activityView.addConstraint(NSLayoutConstraint(item: avtitle,
                                                      attribute: .left,
                                                      relatedBy: .equal,
                                                      toItem: activityView,
                                                      attribute: .left,
                                                      multiplier: 1.0,
                                                      constant: 17))
        
        activityView.addConstraint(NSLayoutConstraint(item: avdetail,
                                                      attribute: .top,
                                                      relatedBy: .equal,
                                                      toItem: avtitle,
                                                      attribute: .bottom,
                                                      multiplier: 1.0,
                                                      constant: 4))
        
        activityView.addConstraint(NSLayoutConstraint(item: avdetail,
                                                      attribute: .left,
                                                      relatedBy: .equal,
                                                      toItem: avtitle,
                                                      attribute: .left,
                                                      multiplier: 1.0,
                                                      constant: 0))
        
        avimg.addConstraint(NSLayoutConstraint(item: avimg,
                                               attribute: .width,
                                               relatedBy: .equal,
                                               toItem: nil,

                                               multiplier: 1.0,
                                               constant: 30))
        
        image.addConstraint(NSLayoutConstraint(item: image,
                                               attribute: .height,
                                               relatedBy: .equal,
                                               toItem: nil,
