![](/img/trans.png)
[英]UICollectionView delegate method “didSelectItemAtIndexPath” not called when UICollection view used in UITableviewCell
[英]UICollectionView didselectitematindexpath delegate?
UICollectionView如何實現didselectitematindexpath,當我選擇一個項目時,給該項目加一個標志,同時將其推到下一個ViewController。當彈出ViewController時,我如何識別選中的(預安全的)項目,如何保留商品的標志? 以上描述如何實現?
UICollectionViewController具有屬性clearsSelectionOnViewWillAppear
,默認情況下它的值為YES,因此在viewWillAppear:
,UICollectionViewController會將所有選中的項設置為unselect。 所以我想這就是您所需要的。
同樣,您可以在調用[super viewWillAppear:]
之前使用[self.collectionView indexPathsForSelectedItems]
在viewWillAppear:
獲取所有選定項目的indexPath。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.