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
9
votes
3 answers

Rotate the image corresponding to the touch drag in iPhone

I want to rotate the image in clockwise or anticlockwise direction corresponding to the user touch drag with its speed. I think this can be done with some math and logic. What would a code sample for this look like?
KingofHeaven
  • 1,195
  • 3
  • 14
  • 27
8
votes
2 answers

UIView: How to check if touches ended inside the same view in which they began

In AcaniUsers, I've created a grid of ThumbView : UIView instances inside of a UITableView. All thumbViews have a width of kThumbSize. How do I detect if touches ended inside the same view in which they began?
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
8
votes
7 answers

touchesEnded not being called??? or randomly being called

If I lift my finger up off the first touch, then it will recognize the next touch just fine. It's only when I hold my first touch down continuously and then try and touch a different area with a different finger at the same time. It will then…
iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
8
votes
1 answer

How can I pass a gesture recognizer from one view to another

I have a view which contains several subviews which are complex controls with several buttons. The superview has gesture recognizers for taps, swipes etc. In some cases, when receiving a single or double touch I would like the superview to pass the…
Avba
  • 14,822
  • 20
  • 92
  • 192
8
votes
3 answers

Getting touches at launch on iOS

On Mac, one can always get the location of the mouse "outside the event stream" (ie, even if you've not subscribed to any delegate methods for mouseUp: et al) by calling [NSEvent mouseLocation]. Is there any way on iOS to get current touch events…
SG1
  • 2,871
  • 1
  • 29
  • 41
7
votes
2 answers

How to get rid of this "points" between my lines when I am drawing?

is there an easy way to not draw this points in my lines? I don't know why this points are there because i never release my finger from screen during drawing of a line. I got the code from a drawing example. // draw a line -…
madmax
  • 1,803
  • 3
  • 25
  • 50
7
votes
4 answers

Is there any ways to handle and/or distinguish Apple Pencil and direct touches in SwiftUI?

I am wondering if there is a way to handle Apple Pencil events in SwiftUI? For example if you like to handle direct touches, and Apple Pencil differently, say direct touch to scroll, but Apple Pencil to draw lines. There is a similar type of…
Kaz Yoshikawa
  • 1,577
  • 1
  • 18
  • 26
7
votes
1 answer

Swift 2: Value of type 'Set' has no member 'anyObject'

I checked my old game and I want to update it in Swift 2.0. When I tried to fix it, Xcode found an error. Error is Value of type 'Set' has no member 'anyObject' on this line of code: var touch:UITouch = touches.anyObject() as!…
user5537162
7
votes
1 answer

How to work with 3D Touch in iOS 9? Does it trigger event when pressure changes?

I wonder if I can detect continuously changing pressure of user input on iPhone 6s. With simple touch it's obvious, from the UIResponder you can hook into touchesBegan and TouchesMoved and you'll have the coordinates every time when the user touches…
mrtksn
  • 412
  • 3
  • 18
7
votes
2 answers

Not receiving touchesEnded/Moved/Cancelled after adding subView

Title more or less says it all. In response to a touchesBegan event, my UIViewController recolours itself and adds some subviews. It never receives the touchesEnded. I guess because the added subviews are somehow intercepting the event. I tried…
Sam
  • 3,659
  • 3
  • 36
  • 49
7
votes
3 answers

UIControlEventTouchDragExit triggers when 100 pixels away from UIButton

At present, the UIControlEventTouchDragExit only triggers when I drag 100 pixels away from the button. I'd like to customize this behavior and bring that range in to around 25 pixels, but I'm relatively new to programming and have never needed to…
Luke
  • 9,512
  • 15
  • 82
  • 146
7
votes
1 answer

UIView bringSubviewToFront: does *not* bring view to front

I am implementing a simple iOS solitaire game that allows the user to drag the cards around in the usual way. The cards are represented with the UIView subclass CardView. All the card view's are siblings which are subviews of SolitaireView. The…
wcochran
  • 10,089
  • 6
  • 61
  • 69
6
votes
3 answers

reloading tableview and touch gestures

I have a tableview which is being reloaded as new content is added, using [tableview reloadData]; Trouble is I have a UILongPressGestureRecognizer on the TableCells in the Table and because the cells / table are being reloaded quite often the…
daihovey
  • 3,485
  • 13
  • 66
  • 110
6
votes
6 answers

how identify touch in a particular view

How to get touch on a particular view. I am using CGPoint Location = [[touches anyObject] locationInView:self.view ]; but want to trigger the action only if an particular subView is clicked. How to do this.
Kumar sonu
  • 535
  • 11
  • 24
6
votes
1 answer

Detecting touches in MPVolumeView

I'm replicating an MPMediaPlayerView using AVPlayer so I can add some functionality to it. I've created an UIView with play/pause and I display it on a touch and then set a timer to hide it as per the HeadsUpUI sample code. I've added a MPVolumeView…
Mark Lilback
  • 1,154
  • 9
  • 21
1 2
3
44 45