tôi đã sử dụng đoạn mã sau vào một UICollectionViewController
Kéo để làm mới trong UICollectionView trong ViewController
override func viewDidLoad() {
self.collectionView!.alwaysBounceVertical = true
let refresher = UIRefreshControl()
refresher.addTarget(self, action: "refreshStream", forControlEvents: .ValueChanged)
refreshControl = refresher
collectionView!.addSubview(refreshControl!)
}
func refreshStream() {
print("refresh")
self.collectionView?.reloadData()
refreshControl?.endRefreshing()
}
Bây giờ tôi cần nó để làm việc với một UICollectionView
bên trong một UIViewController
và tôi googled cho một giờ bây giờ nhưng không thể có được nó đang làm việc. Tôi đánh giá cao bất kỳ trợ giúp nào.
Không phải là nó hoạt động? http://stackoverflow.com/questions/14678727/uirefreshcontrol-on-uicollectionview-only-works-if-the-collection-fills-the-heig – markov
Mã chính là mục tiêu c và nhận xét nhanh chóng giúp tôi giải quyết được nhiều vấn đề : –
Sử dụng số nhận dạng chưa được giải quyết 'Const' –