为什么我无法在原型对象上使用手势识别器? [英] Why I'm getting gesture recognizers cannot be used on prototype objects?

查看:95
本文介绍了为什么我无法在原型对象上使用手势识别器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将UITapGestureRecognizer放到场景中的UITableViewCell内的UIView内时,我从情节提要中得到了以上错误.

I'm getting the above error from storyboard when I dropped a UITapGestureRecognizer inside a UIView which is inside a UITableViewCell in my scene.

知道为什么我会收到此错误吗?

Any idea why I'm getting this error ?

推荐答案

我自己找到了原因.故事板仅允许当我们具有UITableViewController或其子类并且tableview内容应为静态单元格"而不是默认的动态原型"时.在该配置中,我可以在单元格子视图内添加一个手势识别器.

Found the reason myself. storyboard only allows that when we have a UITableViewController or it's subclass and the tableview content should be 'static cells' instead of default 'Dynamic Prototypes'. In that configures I can add a gesture recognizer inside the cell subview.

但这是一个限制,在我的情况下将不起作用,因为我有一个非常自定义的视图控制器子类,而不是表视图控制器子类.需要寻找其他解决方法:(

But that is a limitation and will not work in my case as I have a very customized view controller subclass instead of table view controller subclass. Need to find other way around it seems :(

这篇关于为什么我无法在原型对象上使用手势识别器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆