问题标签 [touches]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
5 回答
2059 浏览

iphone - UIScrollview 上的“静态”UIButton?

我想达到一个相当简单的效果。滚动视图和其上方的静态按钮。到目前为止没有问题。不幸的是,如果我想“通过”按钮滚动视图,就会出现问题。所以开始在按钮内部拖动会影响按钮,而不是滚动视图。

关于如何实现这一目标的任何想法?

非常感谢!

我认为这种方法行不通,因为 touchesBegan 在 UIScrollView 中已被弃用……(此信息是真的吗?)

不是解决方案:-)

不幸的是,这还不起作用。我认为下一个响应者是我的 UIView 而不是我的 UIScrollView。有任何想法吗?

如果我的视图控制器(即 nextResponder)将触摸传递给滚动视图,则也不会发生任何事情。

0 投票
1 回答
507 浏览

iphone - 任何控件的 iPhone 触摸事件

我正在使用 core-plot 库进行一些绘图,并希望在图形上实现一些触摸控制。问题是,核心图视图似乎没有响应触摸。我读过很多地方,可以在另一个控件上放置一个不可见的控件并使用该控件来提供底层控件触摸事件。问题是,我不知道如何实现它。似乎没有任何工作。有没有办法专门为您自己的触摸事件分配一个控件并将它们与其他控件分开处理?一些显示如何正确设置的源代码会很棒。

0 投票
2 回答
1031 浏览

iphone - 如何在iphone中的触摸事件上调用图像

我创建了一个应用程序,其中有 2 个图像视图,并且我在图像视图上添加了图像。我希望当我点击我的图像时,图像应该被选中并且值应该保存在 sqlite 数据库中。所以我创建了触摸方法,并为两个图像添加标志,以便选择特定图像时,它由其标志标识。这是我的代码:

但是我遇到了一个问题,当我选择我的第一个图像时,它会正确进入 if 部分并将值 1 存储到 var 1 但是当我单击 secimage 它没有进入 elseif 部分时,它只是退出了循环。可能会发生什么是问题。请帮我解决这个问题。谢谢

0 投票
1 回答
285 浏览

iphone - 如何处理子视图中的触摸事件

这是我的代码:

主视图:

子视图:

但为什么我不能在触摸事件中运行代码?

0 投票
3 回答
2909 浏览

uiimageview - IOS。如何启用透明图像以将触摸传递给其下方的 UIButton?

对于我正在编写的 iPad 应用程序,我有一个容器 UIView,其中包含两个子视图,它们是 UIView 子类:

  • 一个 UIImageView,其图像的一部分被切掉以显示其下方的内容。
  • UIImageView 下方的 UIButton,通过 UIImageView 的切除部分显示。

由于 UIImageView 在空间上与 UIButton 重叠,因此即使 UIButon 由于 UIImageView 中的 alpha 遮罩切口而完全可见,它也会阻止触摸到达 UIButton。如何允许 UIImageView 将触摸传递给它的兄弟 UIButton?

谢谢,
道格

0 投票
7 回答
57644 浏览

iphone - UITableView 上的触摸事件?

我在视图中有UIViewController一个UITableView孩子,我想要做的是当我触摸任何一行时,我在底部显示一个视图。如果用户触摸行或底部视图之外的任何其他位置,我想隐藏该视图。

问题是当我点击UITableView它时不会触发touchesEnded事件。

现在我如何检测触摸UITableView并将其与行选择事件区分开来。

谢谢。

0 投票
2 回答
2943 浏览

objective-c - 子视图没有收到触摸

我有添加 2 个子视图的主视图控制器。

这里我们将子视图添加到主视图控制器。两个子视图都是使用界面构建器构建的视图控制器。

两个子视图都正确显示,即使 MenuSceneBackground 视图控制器中的某些动画也可以正常工作,但是这些子视图都没有接收到触摸事件。

它们都实现了 touchesBegan 但只有主视图控制器接收它们。

我尝试将主视图控制器 userInteraction 设置为 NO,并且没有实现 touchesBegan 方法,但这只会使触摸被忽略。

两个子视图都显示在整个屏幕尺寸上。

我确实读过类似的问题,但回答没有帮助。

我在子视图中有这个

我在这里先向您的帮助表示感谢。

0 投票
2 回答
512 浏览

iphone - 为什么 UIEvent 在 touchesBegan 和 touchesMoved 中是不同的对象?

在示例项目aurioTouch应用程序委托中,代码表明(我在其他地方读过)传递给 touchesBegan、touchesMoved 和 touchesEnded 的触摸事件对象将是同一个对象,但它仍然是一组用户操作,例如触摸并移动一根手指。当我重写 UIScrollView 并实现这些方法时,我得到的事件是不同的对象。我在这里想念什么?

0 投票
1 回答
1389 浏览

ios - Detecting touches with stacked Views & passing Touch events from a UIScrollView

I'm trying to close a pop-up menu if the user selects anywhere EXCEPT with-in the bounds of the pop-up itself. In other words, they select the background, the pop-up closes.

I currently have a RootViewController that loads a UIView with a bunch of other UI Elements. At one point, a pop-up (custom) menu is rendered - this is a separate UIViewController with associated .xib. Its loaded on the screen by:

This view occupies only a small portion of the screen. So added detect code for touches to this view will only register the callback if you're ON the view.

If I don't handle touches in the "SectionsChooserViewController" and instead implement the touchesBegan in the rootViewController (which loads the "SectionsChooser...") it doesn't get called for 90% of the view because the UIScrollView's that I have seem to register the touch and not pass it on.

Is there a way to make the UIScrollView pass the touch event?

Edit: At least I think the UIScrollView's are taking the touch event. I'm not sure - I have nearly 20 UI Controls on the page.

Edit: Ok, it is the UIScrollView. If I turn off interaction-enabled on both scrollView's the UIView will get the touches, but this breaks the UIScrollViews - so that won't work.

0 投票
1 回答
295 浏览

ios - UIScrollview 触摸

我有一个UIScrollView允许用户放大/缩小的实例。我已经按照文档实现了一个委托来处理这个问题。但是,我想知道用户触摸滚动视图的位置(相对于滚动视图的超级视图框架)。我可以拦截这些信息,例如通过滚动视图的某些属性,而不覆盖 saytouchesMoved:withEvent:吗?

[UIScrollView实例内部决定他们收到的触摸类型。我不想效仿这个,我想知道触摸的决定和位置。]