Questions tagged [touchesbegan]

Use this tag for questions related to touchesBegan:withEvent, a UIResponder event-handling method in the UIKit framework and MonoTouch.UIKit Namespace.

touchesBegan:withEvent: is a UIResponder event-handling method in the UIKit framework and MonoTouch.UIKit Namespace that is triggered when one or more fingers touches the screen.

Along with touchesCancelled:withEvent:, touchesEnded:withEvent:, and touchesMoved:withEvent:, it is one of the primary touch event-handling methods.

Syntax Examples

func touchesBegan(_ touches: Set<UITouch>,
     withEvent event: UIEvent?)

- (void)touchesBegan:(NSSet<UITouch *> *)touches
        withEvent:(UIEvent *)event

[MonoTouch.Foundation.Export("touchesBegan:withEvent:")]
public virtual Void TouchesBegan (NSSet touches, UIEvent evt)

Resources

Related Tags

451 questions
5
votes
1 answer

Swift Sprite Kit Began Touch Function

Im messing around with an xcode project and I am trying to make a red ball SKShapeNode move around when I touch it. My own source code in the touch began class is not doing the trick. What is the flaw with my code and what do I need to do in order…
Cj Miller
  • 51
  • 1
  • 7
5
votes
1 answer

touchesBegan Vs UITapGestureRecognizer

So I'm making a spritekit game using swift. And I was wondering which is best to use gesture wise? Currently I have a override func touchesBegan handling all taps and a UILongPressGestureRecognizer handling long taps/holds. So you know, a tap…
Reanimation
  • 3,151
  • 10
  • 50
  • 88
5
votes
4 answers

Dragging views on a scroll view: touchesBegan is received, but no touchesEnded or touchesCancelled

As an iOS programming newbie I am struggling with a word game for iPhone. The app structure is: scrollView -> contentView -> imageView -> image 1000 x 1000 (here fullscreen): I think I have finally understood how to use an UIScrollView with Auto…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
4
votes
1 answer

How to cancel uitouches?

In my app I want to have the users tap on the left side of the screen to increase their speed and swipe on the right side to work a joystick. However, if the user keeps holding the left side, the joystick doesn't work right. I am using…
Greg
  • 1,296
  • 2
  • 11
  • 26
4
votes
2 answers

Animated UIView object jumps when touchesBegan is invoked

I have a UILabel object which is being animated, moving up and down. I am coding in Xcode 8.3 with Swift 3. A user can pan this object and drag around to one location to get some points. I am handling the pan/drag using touchesXXX gesture. When I…
Heelara
  • 861
  • 9
  • 17
4
votes
1 answer

Why does touchesBegan not fire when the number of touches changes?

For some reason my touchesBegan method doesn't seem to be responding correctly. If I touch the screen with two fingers, then lift one up and put it down again, touchesBegan gets called correctly. If I touch the screen with one finger, then add a…
Davido
  • 2,913
  • 24
  • 38
4
votes
1 answer

touchesBegan not firing in UICollectionViewController

I have a UICollectionViewController class that lays out bunch of cells. When the user touches a cell, I want to use the touchesBegan method to prevent new touches until the first touch has completed its selection of a cell. I tried putting the…
4
votes
2 answers

iPad Simulator not receiving touch events outside of iPhone's 320x480 frame

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject]; gestureStartPoint = [touch locationInView:self.view]; NSLog(@"test x:%f",gestureStartPoint.x); NSLog(@"test y:%f",gestureStartPoint.y); …
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
4
votes
3 answers

Subclass UIScrollView in Swift for touches Began & touches Moved

I'm using Swift 1.2 I'm trying to use this UIScrollview touchesbegan,touchesmoved,touchesended actions and the link in the 2nd comment of the accepted answer. I'm using a storyboard with auto layout, I set my custom class for the UIScrollView in…
Fred Faust
  • 6,696
  • 4
  • 32
  • 55
4
votes
1 answer

Touch controls working for iOS 7,6,5... but not for iOS 8

I developed a OpenGL ES game several years ago and works well until now: I have downloaded Xcode 6 and iOS 8 in my iPad 3, and touch control (touchesBegan, touchesMoved, touchesEnded) only detect a square of 768x768 points, instead of 1024x768. A…
Marc
  • 61
  • 1
4
votes
3 answers

Draggable UIView stops posting touchesBegan after being added to UIScrollView

In Xcode 5.1 I have created a simple test app for iPhone: The structure is: scrollView -> contentView -> imageView -> image 1000 x 1000 on the top. And on the bottom of the single view app I have seven draggable custom UIViews. The dragging is…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
4
votes
1 answer

viewDidLayoutSubviews called after touchesBegan - again and again

In an iPhone word game I have an UIScrollView (holding UIImageView) and 7 draggable custom UIViews placed initially at the bottom (and outside the scroll view): In the single ViewController.m I have overwritten viewDidLayoutSubviews so that it…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
4
votes
3 answers

Touch and drag a UIButton around, but don't trigger it when releasing the finger

I'm trying to allow some UIButton instances on one of my views to be touched and dragged around the screen (eventually with momentum, but that's for later!). I have this working in a very simple form, shown below, but the problem is that by touching…
Luke
  • 9,512
  • 15
  • 82
  • 146
4
votes
1 answer

iOS: How do paint/draw apps eliminate the initial delay in response to touches?

When I've used painting/drawing apps, I never notice a delay between pressing my finger and being able to see something drawn on the display. However with my app, the initial touches are received very slowly. The second and third and fourth gestures…
user1312991
3
votes
2 answers

UIScrollView Subclass never receives touchesBegan message for swipes

I am trying to make a scroll view only scrollable on a certain region. To do this, I am subclassing UIScrollView and overriding touchesBegan (similar to this question). Here's my (pretty simple) code. .h @interface SuppressableScrollView :…
bbrame
  • 18,031
  • 10
  • 35
  • 52
1 2
3
30 31