Questions tagged [uitouch]

UITouch is a class from UIKit framework in Apple iOS. A UITouch object represents the presence or movement of a finger on the screen for a particular event.

A UITouch object includes methods for accessing the view or window in which the touch occurred and for obtaining the location of the touch in a specific view or window. it also lets you find out when the touch occurred, whether the user tapped more than once, whether the finger is swiped (and if so, in which direction), and the phase of a touch—that is, whether it began, moved, or ended the gesture, or whether it was canceled.

A UITouch object is persistent throughout a multi-touch sequence. You should never retain an UITouch object when handling an event. If you need to keep information about a touch from one phase to another, you should copy that information from the UITouch object.

666 questions
3
votes
2 answers

Getting the number of fingers touching a UIView

I want to change the color of a UIView based on the number of touches currently on it. I have managed to create this with a single touch: class colorChangerViewClass: UIView { override func touchesBegan(_ touches: Set, with event:…
Marmelador
  • 947
  • 7
  • 27
3
votes
1 answer

Is it possible to cancel a touch from inside touchesBegan or touchesMoved?

In my main view in a UIViewController I have a mapView and a another view (Let's say view A) that is above mapView. Both of them have frames equal to self.view.bounds. The view A is a rectangle that is resizable similar to those used to crop…
rgoncalv
  • 5,825
  • 6
  • 34
  • 61
3
votes
2 answers

How to track multiple touches

Hey I have a Good peice of code in my touches moved it was given to me by @Sam_M. Im trying to basically keep track of the location of multiple fingers when there moving. Like Finger 1 is here and Finger 2 in there. So as of right now it will print…
Hunter
  • 107
  • 1
  • 10
3
votes
5 answers

How to save touchesBegan touchLocation values

How do I save the touchesBegan value. I am using UItouch to move 5 UIImageViews and when you place the imageView at the right place the imageView stays in the right position. But if you don't place it in the right position the imageView should jump…
user3266053
  • 175
  • 1
  • 1
  • 10
3
votes
0 answers

Track fingers in UIViewController

I want to track down the position of my fingers in a UIViewController. I implemented this with the following function and this is working great! override func viewDidLoad() { view.userInteractionEnabled = true view.multipleTouchEnabled =…
Bas
  • 780
  • 5
  • 17
3
votes
0 answers

Ignoring Touch on Transparent Pixels

I have a scene with many overlapping images. The images themselves can be a variety of shapes. But for this example lets say all the images are tetris shapes. I was under the impression that when you touched on a node in UItouch using spritekit…
NeHe
  • 31
  • 2
3
votes
0 answers

Custom callout catch touch event

I am using SMCalloutView To create a custom callout for my mapView. The problem I am running into is when the callout view is visible and the user presses on the callout, if another annotation is under the callout view it will dismiss the current…
RandomBytes
  • 1,781
  • 1
  • 13
  • 14
3
votes
2 answers

event.touchesForView().AnyObject() not working in Xcode 6.3

This worked perfectly before: func doSomethingOnDrag(sender: UIButton, event: UIEvent) { let touch = event.touchesForView(sender).AnyObject() as UITouch let location = touch.locationInView(sender) } But in Xcode 6.3, I now get the…
Naftali Beder
  • 1,066
  • 1
  • 10
  • 27
3
votes
2 answers

Is there a way to ignore a uitouch in objective-c?

I am trying to make this app: User places finger on screen to be traced. A second finger traces around the first finger and an outline of the first finger should be drawn.(essentially just a drawing app that ignores the first finger being held on…
kkimble006
  • 31
  • 3
3
votes
1 answer

Sprite-Kit Change Image of Node when screen gets touched

There is a hero that is controlled by tapping on the screen. I want the hero too look a little different every time the screen gets touched. What I did is setting up two images that are a little different. I want the image of the hero to be changed…
Elio_
  • 398
  • 4
  • 13
3
votes
3 answers

UIScrollView isDragging returns YES when no scrollview is decelerating

I want to know if a UIScrollView (UITableView) is dragging (panning) because the user's finger is actively panning it (the user's finger is on the scrollview . i.e. on the screen) or because the scroll view was "flicked" and it is scrolling (i.e…
Avba
  • 14,822
  • 20
  • 92
  • 192
3
votes
2 answers

How to effectively process UITouches in a multitouch sequence

I am working with multitouch while writing, So basically what I am doing is, I am writing with hand support, because typically, its how user writes, I followed this link How to ignore certain UITouch Points in multitouch sequence Everything is…
Ranjit
  • 4,576
  • 11
  • 62
  • 121
3
votes
2 answers

touchesMoved method gets called four to five times and touch gets cancelled

I have implemented touches method inside a view. touchesMoved method gets called four to five times and touch gets cancelled automatically. Can u please tell me the reason for this? Thanks in advance
Mukul
  • 43
  • 5
3
votes
1 answer

Creating a UITouch object

In my iPhone app I'm overriding the touchesBegan:withEvent method in my view and what I want to do is make some tweaks to the UITouch object found in the NSSet and send it to another view. I couldn't find anywhere how to create a UITouch object.
ForeignerBR
  • 2,449
  • 4
  • 23
  • 28
3
votes
2 answers

Is there a way to retrieve every responder that has handled a UITouch?

I'm trying to debug some touchesBegan/Moved/Ended related slowdown in my game; I think that some of my touch responders are not unloading properly, and so as the game runs on more and more of them stack up and the touches get less responsive because…
spencewah
  • 2,196
  • 4
  • 20
  • 31