我有一个按钮的自定义单元格,我正在尝试向它添加一个操作。出于某种原因,该应用程序崩溃的错误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