问题标签 [uitouch]

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 投票
2 回答
1161 浏览

iphone - 多个uiimageview触摸

我只是想计划一个新的应用程序......我想要一系列图像,用户可以在屏幕上拖动它们并放在他们想要的地方。

我在想我会有一个包含所有图像的数组(NSMutableArray)。当应用程序加载时,它会将它们绘制到可滚动的 UIView... 然后应用程序将知道哪个用户已按下并拖入主视图。

我可以对其进行编码,以便可以拖动一张图像,但我不确定如何将相同的代码应用于 n 个图像。例如,在我的视图控制器中,我IBOutlet UIImage *image在 IB 中设置了可以链接和控制的内容....但是如何将其更改为适用于任意数量的图像?

我整个早上都在尝试寻找这个,但运气不佳。

我想我需要为每个图像应用一个类,因为我将它从数组中绘制出来。我只是在这里得到一点建议 - 也许指向正确的方向?

感谢您提供任何信息!

0 投票
1 回答
3266 浏览

ios - 什么是 touches cancelled 事件,它与 touches end 有什么不同

我只是不明白苹果的触摸取消事件是什么意思以及它是如何调用的。

0 投票
4 回答
9207 浏览

iphone - 有什么办法可以告诉我屏幕被按下有多难

我想找到触摸的压力。我只是不知道如何在不越狱并获取原始触摸数据的情况下实现该结果。有谁知道我会怎么做?

0 投票
2 回答
1613 浏览

iphone - 无需 UIEvent 即可获得所有触摸

我正在寻找一种方法来获取所有当前的触摸,即使没有发生任何事件。我知道,[UIEvent allTouches]但我需要能够看到“这些都是屏幕上的触摸”,即使它们都没有改变。似乎应该是可能的,因为allTouches可以访问尚未更新的触摸,因此手机正在跟踪它们。

0 投票
2 回答
419 浏览

iphone - 使用 3 次触摸而不是一次的 UIScrollView

我想知道是否有某种方法可以通过 UIScrollView 使用三点触控。我最终想要的是让 UIScrollView 只被传递一个 UITouch (或者至少认为它只有一个触摸),但是有三个触摸。我想使用让我们说中指或找到三个触摸的平均值 (x , y) 并将 (x , y) 用作发送到 UIScrollView 的一次触摸。如果有人知道或知道我如何完成此操作,请尽可能上传一些代码。

0 投票
1 回答
2085 浏览

cocoa-touch - UIScrollView 触摸覆盖

我想知道如何停止我的 sublass o UIScrollView 无法正常工作:

我只希望它在它有 2 触动我不想做的所有其他事情时采取行动。或者更好的是,如果你能告诉我如何将 else 语句中的触摸传递给 UIView:

如果你能告诉我如何做到这一点,那么我会很高兴。

0 投票
1 回答
113 浏览

iphone - Is there a class / method to handle dragging views?

I found a useful tutorial to get started in understanding how to Cocoa handles touch events. I've used this as a base to create a custom script, I'm trying to make a UIView draggable, very similar to the native Maps application.

  • I've written a custom script, using the touchesBegan method it will capture where the input began and compare it to the centre point of the UIView using some conditional statements.
  • The touchesMoved method will do some further conditional statements to determine whether the touch start point and the center of the view will move positively or negative.
  • I've also captured the views boundaries so it doesn't go too far out.

it's lacking the polished finished found in other applications such as Maps, or scrolling a UITable, such as the ease effect after the user has released their fingers, and the snapping effect when it reaches the boundaries is horrible.

Is there a method that takes a view and makes it draggable like this? If not I'll continue to refine my script.

Many thanks!

0 投票
4 回答
13972 浏览

iphone - 将 UITouch 位置与 UIImageView 矩形进行比较

我有以下代码来确定触摸是否在我的表格单元格的图像视图中。但是,它不起作用。我将两者与 CGRectContainsPoint 进行了比较,但是它不起作用。这是代码:

谢谢您的帮助!

0 投票
4 回答
2070 浏览

iphone - 如何在 -(void)touchesMoved 期间只调用一次方法?

- (void) touchesMoved当我进入一个特定的框架时,我习惯于做一些事情,在这种情况下是一个按钮的区域。

我的问题是,我只希望它在我进入框架时做一些事情——而不是当我在框架内移动手指时。

有谁知道我在框架内时如何只调用一次我的方法,如果我在同一个 touchMove 中重新输入它,仍然允许我再次调用它。

谢谢你。

0 投票
1 回答
342 浏览

iphone - 禁用的按钮如何被触摸?

我只是想知道这怎么会发生。在我的 iPhone 应用程序中,在加载 http 请求期间,我禁用了导航栏中的按钮。但是当我触摸按钮三四次时,加载完成后会调用 action 方法,这意味着即使按钮被禁用,也会在其上检测到触摸,然后调用 ibaction 方法。

那么这是特殊情况还是有什么方法可以防止这种情况发生?

谢谢 ....