Ios 点击UITableViewCell类中的UIImageView时如何打开新屏幕?
我的TableViewCell在它自己的类VersionCellVC中 我的视线完全遮住了牢房;因此,用户别无选择,只能点击UIImageView,而不是TableViewCell 我想执行一个序列或演示一个vc,我已经创建了手势识别器及其调用的函数。但是,由于我在UITableViewCell的自定义子类中,系统告诉我,我不允许使用Ios 点击UITableViewCell类中的UIImageView时如何打开新屏幕?,ios,swift,uitableview,uiimageview,uigesturerecognizer,Ios,Swift,Uitableview,Uiimageview,Uigesturerecognizer,我的TableViewCell在它自己的类VersionCellVC中 我的视线完全遮住了牢房;因此,用户别无选择,只能点击UIImageView,而不是TableViewCell 我想执行一个序列或演示一个vc,我已经创建了手势识别器及其调用的函数。但是,由于我在UITableViewCell的自定义子类中,系统告诉我,我不允许使用当前(vc:animate:complete)或准备(forSegue:…)函数,因为它们不是UITableViewCell类的成员 如何在不将UIImageVie
当前(vc:animate:complete)
或准备(forSegue:…)
函数,因为它们不是UITableViewCell类的成员
如何在不将UIImageView更改为UIButton的情况下解决此问题?类似的情况(在包含tableview的viewcontroller中)如何
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CustomCell", for: indexPath) as! CustomCell
cell.myImageView?.isUserInteractionEnabled = true
cell.myImageView?.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(imageViewTapped(imageView:))))
return cell
}
func imageViewTapped(imageView: UIImageView) {
if let indexPath = tableView.indexPathForRow(at: imageView.convert(.zero, to: tableView)) {
print("user tapped imageview at indexPath \(indexPath)")
}
}