refreshView是Xib,,用UINib加載Xibspa
let nib = UINib(nibName: "RefreshView", bundle: nil) return nib.instantiateWithOwner(nil, options: nil)[0] as! RefreshView
給xib設置約束的時候必定要重寫賦值size,,用當前的大小賦值便可,,若是不設置,,位置可能不對的code
refreshView.snp_makeConstraints { (make) -> Void in // make.centerX.equalTo(self.snp_centerX) // make.centerY.equalTo(self.snp_centerY) make.center.equalTo(self.snp_center) make.size.equalTo(refreshView.bounds.size) }