     @IBOutlet weak var goodsCollectionView: UICollectionView!
     
     var goods = [Goods]()
-    var tagSelect = UIButton()
+    var refreshControl = UIRefreshControl()
     
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        self.loadTagView()
-        self.loadProduct(1)
+        loadTagView()
+        loadProduct(1)
 
         //创建一个cell放入内存以便重用
         goodsCollectionView.registerNib(UINib(nibName: "LogMenuCollectionViewCell", bundle: nil), forCellWithReuseIdentifier: "cell")
-
+        
+        refreshControl.addTarget(self, action: "refreshData", forControlEvents: UIControlEvents.ValueChanged)
+        refreshControl.attributedTitle = NSAttributedString(string: "下拉刷新数据")
+        refreshControl.tintColor = UIColor.redColor()
+        goodsCollectionView.addSubview(refreshControl)
     }
 
     override func didReceiveMemoryWarning() {

            btn.setTitleColor(UIColor.redColor(),forState: .Highlighted)
            btn.tag = ((arr![index]["id"]) as? Int)!
            btn.addTarget(self, action: Selector("tagClick:"), forControlEvents: .TouchUpInside)
            self.goodsScrollView.addSubview(btn)
        }
    }
    
    //MARK:点击标签
    func tagClick(btn : UIButton){
        print(btn.tag)
        self.loadProduct(btn.tag)
    }
    
    //MARK:加载商品

        }
    }
    
    
    
    //MARK:上拉刷新
//    func onPullToFresh(){
//
//    }
    
    //MARK:下拉刷新
    func refreshData(){
        self.goodsCollectionView.reloadData()
        self.refreshControl.endRefreshing()
    }

    
    //MARK: 设置cell的数量
