- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
伙计们,我有显示图像的表格 View ,因此对于任何图像,点击都会在
中打开图像didselectrowatIndexpath
所以我想添加一个长按手势所以我添加了
let longPressGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPressed(_:)))
cell.baseview.addGestureRecognizer(longPressGesture)
但每次我按住图像时,它都会使用 didselectrowat 方法打开图像,而不是使用长按方法。对于长按手势 Action ,我应该改变什么吗?
最佳答案
这是 Apple 对您问题的回答。
Managing Selections (Responding to Selections)
If the touch occurred in a control embedded in the row, it couldrespond to the action message sent by the control.Understanding Responders and the Responder Chain
UIKit directs most events to the most appropriate responder object in your app. If that object does not handle the event, UIKit forwards it to the next responder in the active responder chain, which is a dynamic configuration of your app’s responder objects.
解决方案:
您在图像的用户交互方面存在问题。在 ImageView 上启用用户交互。
cell.baseview.isUserInteractionEnabled = true
关于iOS TableView 长按手势去 didselectrowatIndexpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45608089/
我需要在 didSelectRowAtIndexPath 方法内部再次调用 UITableView 中的 didSelectRowAtIndexPath 方法。 代码如下: -(void)tableV
我正在尝试在单元格创建 cellForRowAt 中手动调用 didSelectRowAtIndexPath,因为这将更新详细 View 而无需实际触摸该行,但是当我这样做时所以我在实际委托(dele
出于某种原因,我无法在以下代码中的第一个 IF 语句之后访问任何变量。例如,如果索引路径为[0,0],则变量phoneText 会输出电话号码。但如果它是 [1,0] 或 [2,0],我会得到“nul
我知道之前提到过这个问题,但那里的解决方案并不适用。我有一个使用 IB 设置的带有嵌入式 UITableViewController 的 UINavigationController 。在IB中,UI
我遇到了 ios 5 的 UITableView 的 didSelectRowAtIndexPath 问题,这在 ios 4 中是正确的。 第一次点击表中的任何行时,不会调用该方法。一旦我选择另一行,
我有一个 Viewcontroller,它是 UITableViewController 的子类。基本上我的问题是当我们点击主按钮时委托(delegate)方法被调用: - (void)tableVi
我在 uitextfield 正下方有一个 uitableview,它在 uitableview 单元格 中填充类似的字符串。项目被填充。但是,长按后会调用 didSelectRowAtIndexPa
所以我试图默认在我的 View 首次加载时选择 tableView 中的第一行。我正在这样做我的 viewWillAppear 方法: NSIndexPath *tempPath= [NSIndexP
我想在某个条件不满足时中止这个方法,我该怎么做? 我不使用 tableView:willSelectRowAtIndexPath: 方法。我认为可以结合这两种方法来防止某些行被选择并被推送到另一个 V
我有一个分为2个部分的UItableView。 我如何管理tableView didSelectRowAtIndexPath方法? 对于第1部分,该方法正在运行,但是对于第二部分,我不知道如何实现。
在我的应用执行期间的各个时间点,都需要使用以下命令以编程方式选择UITableView的一行 [self.tableView selectRowAtIndexPath:selectedCellInde
我有一个自定义的 UITableViewCell,其中包含一些 TextView 和一个 ImageView 。这些 View 是不可选择的(在 IB 中设置)。我希望当用户点击单元格内的任意位置时触
我用它创建了一个表和一个搜索栏 Controller 。我使用了一个结构来创建表内容。我只想将所选单元格中的数据存储在变量中。我是一名新的 iOS 开发人员。请帮忙:) TIA //my struct
我在表格 View 中有 5 个自定义单元格,但 didSelectRowAtIndexPath 仅适用于一个单元格。我已在代码中该单元格的索引处添加了该行的单元格。 let cell : FileS
我现在正在弄乱 table ,我的目标是最终能够点击 table 并转到某个地方。但是,我无法使 didSelectRowAtIndexPath 工作。该表显示正常,但当我选择它时没有任何反应: cl
didSelectRowAtIndexPath:即使在将表委托(delegate)和数据源连接到文件所有者后,方法也不会调用。 当我试图打印一些东西时,它没有用这种方法打印 在下面找到我的代码供您引用
我在 viewController 中有两个 UITableView。两者都有不同的标签。带有标签 0 的 UITableview 是可编辑的,而标签 1 是不可编辑的。我的问题是当在带有标签 1 的
我正在尝试学习在我的应用程序中使用核心数据。我怎么会被困在这里 didSelectRowAtIndexPath 如果可能的话,我希望能够像以前一样使用我的 uitableview arrayA 是一个
我有一个 UITableView,其中填充了 30 多个 UITableviewCell。 我面临的问题是,当选择一行并更改单元格的 accessoryType 时,该行的第十一行也会被修改。 我已经
在我的 UITableView 中,我有 2 行。我正在尝试禁用第二行,因此我完成了图片中显示的以下操作。当我运行该程序时,虽然该行无法推送到另一个 View ,但当我单击它时蓝色突出显示仍然闪烁。
我是一名优秀的程序员,十分优秀!