uigesturerecognizer

UITextView gesture tap recognizer not working after text begins to edit

你离开我真会死。 提交于 2020-02-04 07:47:26
问题 I am setting up a UITextView with a tap gesture recognizer so that I can do various things after the textView is tapped. For one I want the text view to be the "selected" view after it is tapped, like so: selectedTextView = (UITextView *)recognizer.view; It works, except that after the text view goes into text edit mode, reveling the keyboard and allowing text editing, thereafter my custom tap gesture recognizer no longer works. Any way around this? 回答1: You might just need to return YES for

UITextView gesture tap recognizer not working after text begins to edit

一个人想着一个人 提交于 2020-02-04 07:47:04
问题 I am setting up a UITextView with a tap gesture recognizer so that I can do various things after the textView is tapped. For one I want the text view to be the "selected" view after it is tapped, like so: selectedTextView = (UITextView *)recognizer.view; It works, except that after the text view goes into text edit mode, reveling the keyboard and allowing text editing, thereafter my custom tap gesture recognizer no longer works. Any way around this? 回答1: You might just need to return YES for

I add a UIGestureReconizer to a view to detect Touch Down action, but then the buttons above the view won't work anymore

≡放荡痞女 提交于 2020-01-25 10:39:05
问题 I have a view which needs to detect "Touch Down" action on the full view, after I found out normal UITapGestureRecognizer can't accomplish it, I customize UIestureRecognizer class to achieve it, using this. So it does work, but I have several buttons on the view, after I can detect the Touch Down action for the view, those buttons stop to work. I need both of them to work, the view to detect Touch Down and the buttons can be pressed above the view. How can I achieve it? To be clear, those

Change uiview size after rotation transform

白昼怎懂夜的黑 提交于 2020-01-24 19:20:58
问题 My code needs some help from professional xcoders :-) I have a draggable uitextview called "headline" that is a subview in "mainstage". I also added a pinch gesture to change the fontsize inside the uitextview. Everything works fine but the last essential feature that I really need is the rotation of the uitextview. So I added a uislider for rotation and volia! it also works. But after this transformation the uitextview goes crazy* when it becomes a new size via the pinch gesture. (*The

Pan and Tap gesture recognizer for same view, which need to fail for the other?

懵懂的女人 提交于 2020-01-24 05:08:06
问题 I need to detect Pan and Tap on the same view, but the tap action is also the first action for pan, so I assume the Tap action need the Pan action to be failed, but then does it make any delay as it has to wait a little bit in order to know if a tap is followed by a movement for a Pan? Thanks 回答1: the tap action is not the first action for a pan. the tap happens after touch up (e.g. the user lifts their finger). the pan happens while the touch is still down (e.g. the finger is pressing on the

Pinch, drag and pan at the same time

喜夏-厌秋 提交于 2020-01-23 11:18:06
问题 I have a label on the UIImageView as below. The label is draggable, pan-able and pinch-able. However I can only do one gesture at a time. For example, I want to drag the label while I'm pinching it like in texts on images in Snapchat and Whatsapp. My functions are as below. As I searched, I think I should create a custom gesture recognizer but I don't know how. Is there any way I can do it without creating a custom recognizer? I got help from this post while doing this: Snapchat-like text on

iPhone App increase Shake gesture Sensitivity

对着背影说爱祢 提交于 2020-01-23 05:13:46
问题 In my iPhone App I have used shake gesture it is working but it requires lots of efforts to shake Is there any way to make it more sensitive or increase the sensitivity? here is the code - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (motion == UIEventSubtypeMotionShake) { [self performSelector:@selector(startPressed:)]; } } Please help and Suggest. Thanks 回答1: The isnt a way to do it directly as far as I'm aware. One way to get around this would be to use the

UIGestureRecognizer with closure

半腔热情 提交于 2020-01-21 07:21:45
问题 I have as view, in which I want to perform a swipe right gesture. Unfortunately I receive the error EXC_BAD_ACCESS. Does anybody know what's wrong here ? Please a look at the code below. extension UIView { func addGestureRecognizerWithAction(nizer: UIGestureRecognizer, action:() -> ()) { class Invoker { var action:() -> () init(action:() -> ()) { self.action = action } func invokeTarget(nizer: UIGestureRecognizer) { self.action() println("Hi from invoker") } } addGestureRecognizer(nizer)

Swift - How to remove swipe gesture from scene when moving to another one?

孤街醉人 提交于 2020-01-21 03:46:25
问题 So my game uses swipe gestures, in my didMoveToView() function I have these gestures initialized: let swipeRight = UISwipeGestureRecognizer() swipeRight.direction = UISwipeGestureRecognizerDirection.Right self.view?.addGestureRecognizer(swipeRight) let swipeLeft = UISwipeGestureRecognizer() swipeLeft.direction = UISwipeGestureRecognizerDirection.Left self.view?.addGestureRecognizer(swipeLeft) let swipeUp = UISwipeGestureRecognizer() swipeUp.direction = UISwipeGestureRecognizerDirection.Up

Using UIPinchGestureRecognizer to scale uiviews in single direction

给你一囗甜甜゛ 提交于 2020-01-19 07:39:30
问题 I would like to know how we can use UIPinchGestureRecognizer to scale UIView in single (x or y) directions alone. Say, if the user moves his two fingers in a pinch gesture only in a single direction (horizontal), only the width of the uiview should increase/decrease and if the fingers are moved only vertically, the height should change. If the fingers move diagonally, then both height and width of uiview should increase/decrease. I have seen the MoveMe sample code from Apple.