我有一個按鈕的自定義單元格,我正在嘗試向它添加一個操作。出於某種原因,該應用程序崩潰的錯誤unrecognized selector sent to instance
。我該如何解決?我的語法似乎正確。爲什麼點擊按鈕時程序崩潰?
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionview.dequeueReusableCellWithReuseIdentifier("searchcell", forIndexPath: indexPath) as! searchcustomcell
//follow is the name of the button in the custom cell
cell.follow.addTarget(self, action: "FollowUser:", forControlEvents: UIControlEvents.TouchUpInside)
func FollowUser(sender: UIButton){
var relation: PFRelation = (PFUser.currentUser()?.relationForKey("Friendship"))!
relation.addObject(users[indexPath.row])
return cell
}
哪個選擇器和哪一類實例? (最好將整個錯誤信息粘貼到問題中,而不是試圖描述它。) –
http://puu.sh/l7awG/7eeebf1813.png – xxtmanxx