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
2
votes
2 answers

Limiting CGAffineTransform Scale

I am transforming a view with CGAffineTransformMake. It rotates, scales and translates. This works just fine. But I cannot figure out a way to limit the scale to a maximum size. If the scale is exceeded, I need to still apply the current rotation…
Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
2
votes
4 answers

How to send touch event to a UIView on iOS

I have added a tap gesture on a view. When the view tapped, an internal method called and an alert popped up. Now I want to send touch event to simulate finger touch on this view. How could I do this? =============== Thanks all. I think I should…
Michael Yuan
  • 73
  • 1
  • 8
2
votes
0 answers

About Reusing UITouch and UIEvent Object

I'm trying to understand UIEvent, UITouch Object reusing So I trying test but result makes me confused this is my code class CustomView: UIView { override func touchesBegan(_ touches: Set, with event: UIEvent?) { …
PrepareFor
  • 2,448
  • 6
  • 22
  • 36
2
votes
1 answer

Dragging a UIView created after touchesBegan

I have a few UIView subclasses that exist in a kind of inventory. When you tap one, another draggable version is placed over top of it. I want the inventory versions to stay put while you drag others around. The code to make a duplicate works but…
rob5408
  • 2,972
  • 2
  • 40
  • 53
2
votes
2 answers

Set has no member "location"

Part of a project that I am working on requires me to make an object be moved using touch. I'm currently running Swift 3.1 and Xcode 8.3.3. The 7th line gives me errors saying: Value of type 'Set' has no member 'location' but I have…
Gerald
  • 109
  • 9
2
votes
1 answer

How to synthesise/ stimulate touch event on iOS device in swift?

In my app, i need to stimulate touch for my app on device. Does anyone know how to simulate touch on device using UITouch & UIEvent in swift? Thanks in advance.
yo2bh
  • 1,356
  • 1
  • 14
  • 26
2
votes
0 answers

How to make a label sticked in rectangle in objective c

Hi there I drag a label with a touch into a hollow rectangle, now I want to make the label stick with a rectangle and should not be movable with any user interaction, How can I make my label stuck with a rectangle? My labels and rectangle are in…
Alex
  • 35
  • 7
2
votes
3 answers

Location of touch in UIButton action

I'm trying to get the (x,y) location of where a button is tapped. I've found answers but they don't work for Swift 2.3. Any suggestions? That's what I have tried: @IBAction func buttonTapped(sender: AnyObject, forEvent event: UIEvent) { let…
Marc Ibrahim
  • 299
  • 5
  • 18
2
votes
1 answer

UIGestureRecognizer vs. UITouch Delegate Performance

I am writing an app for drawing. My main question is: How do I get the best performance from touch events? Is there a difference between UIGestureRecognizer and UITouch Delegates? Are there different refresh rates or sth.? Best Philipp
Philsen3000
  • 107
  • 1
  • 8
2
votes
2 answers

Send UITouches over a network

I am building an app which allows a user to draw on the screen. I'd like to add network capability so that user A can draw on user B's screen. My current plan is to build a system where I have my own UserOrNetworkTouch object which can be created…
morgancodes
  • 25,055
  • 38
  • 135
  • 187
2
votes
2 answers

How to Count the number of times the screen be touched in swift?

How to get the number of times the screen be touched in swift I don't know which method to use, please help
2
votes
2 answers

iphone keyboard touch events

I need to be able to detect touch events on the keyboard. I have an app which shows a screen which occurs after a certain period of inactivity (i.e. no touch events) To solve this issue, I have subclassed my UIWindow and implemented the sendEvent…
Bittu
  • 676
  • 2
  • 8
  • 22
2
votes
0 answers

How to move one image intersect by other image on view using UITouch

I am using UITouch methods for moving the imageView from left-to-right and right-to-left. For this I am using below patch and its working fine -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch1 = [[event…
Asmita
  • 477
  • 8
  • 20
2
votes
1 answer

Is there any way to keep touches alive in iOS?

I'm testing the touch detection capabilities of the iPad (specifically iPad 3 at the moment). I'm printing out a log of detected touches to see what is going on, and using a bottle with three foam (touch friendly) pads at the bottom. The touches…
Feaniro
  • 23
  • 3
2
votes
1 answer

Have UITouch only perform task when touching certain color

How can I have UITouch recognize and perform a certain task ONLY when I touch a certain color in a UIImage view. For example: I have an image of a street. The street has greyish buildings and a white road. If I touch a building, I don't want…
Matt S.
  • 13,305
  • 15
  • 73
  • 129