如何在静态 UITableViewCell
上使用 UITapGestureRecognizer
?到目前为止,我刚刚为静态 UITableViewCell
创建了一个 IBOutlet
。
@IBOutlet weak var settingCell: UITableViewCell!
我想要的是当用户点击此 UITableViewCell
时触发此 IBOutlet
。
@IBAction func share(sender: AnyObject) {
let vc = UIActivityViewController(activityItems: [NSURL(string:"https://www.apple.com/my/itunes/")!], applicationActivities: nil)
/* If you want to exclude certain types from sharing
options you could add them to the excludedActivityTypes */
vc.excludedActivityTypes = [UIActivityTypePostToTwitter]
self.presentViewController(vc, animated: true, completion: nil)
}
我该怎么做?
最佳答案
如果我明白你想要什么,你不需要使用 UITapGestureRecognizer,你可以简单地设置 tableView 及其协议(protocol)(你可能已经制定了),并使用这个函数:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath){
//your action comes in here
}
关于ios - 如何在静态 UITableViewCell 上使用 UITapGestureRecognizer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30625720/