[英]UICollectionView not calling didSelectItemAtIndexPath
[英]didSelectItemAtIndexPath is not calling in ios swift
當我只選擇/點擊項目時,未調用didSelectItemAtIndexPath
方法。 但是,當我長按項目然后選擇了didSelectItemAtIndexPath
它正在完美地調用工作。 為什么會這樣。 我該怎么辦?
我添加了如下的集合視圖
collectionview_followers.frame = CGRectMake(0,50,SCREEN_WIDTH,150)
collectionview_followers.delegate = self
collectionview_followers.dataSource = self
collectionview_followers.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "FollowersCell")
collectionview_followers.backgroundColor = UIColor.clearColor()
collectionview_followers.userInteractionEnabled = true
collectionview_followers.allowsSelection = true
view_collectionviewBG.addSubview(collectionview_followers)
和單元格包含帶圖像和標簽的uiview
確保在super.ViewDidLoad()
之前的viewDidLoad
方法中設置self.tableView.allowsSelection = true
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.