touches

TouchesMoved method for two view controllers

丶灬走出姿态 提交于 2019-12-24 20:23:10
问题 In my app there are two view controllers. I wrote touchesmoved method in both the view controllers. But even if i touch on second view controller on simulator, the first VC touches moved method is called. // for VCOne -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"first view vc move method"); UIStoryboard *storyboard = self.storyboard; ThreadedView *secViewController = [storyboard instantiateViewControllerWithIdentifier:@"threaded"]; [self.view addSubview

Is drawrect more efficient for coregraphcs drawing than using core graphics in touches moved?

走远了吗. 提交于 2019-12-24 08:08:52
问题 My whole app uses touchesMoved for drawing (Coregraphics). Should I be calling [self setNeedsDisplay] from within touchesMoved instead of performing the drawing code in there? Would that stop some lag that I am experiencing? The only reason I didn't try this before posting is because it is going to take me a few hours to convert all drawing to within drawRect and I wanted to know if it would be more would efficient than drawing in touchesMoved ? 回答1: Yes. You should always keep your drawing

IOS 5: UIScrollView not pass touches to nextResponder

心已入冬 提交于 2019-12-23 17:41:09
问题 I have a subclass of UIScrollView , and override all 4 Touches functions for it. In those Touches functions, [[self nextResponder] Touches...] and [super Touches...] are used to pass the touches events. Also I have a view controller in which I override all 4 Touches functions too. In the Controller, I set the self.view as: self.view = subclass of UIScrollview; Before iOS 5, when there are touches move on the scrollview, the view controller's touch functions can receive all touch begin/move

touchesEnded:withEvent: is not called

左心房为你撑大大i 提交于 2019-12-22 00:34:12
问题 If I tap the screen too fast with two fingers, touchesBegan is called, but touchesEnded is not called for one of the touches. I've googled like crazy and this seems to be a serious issue that people have been having since at least 2010. Apparently it hasn't been fixed. Does anyone know of a workaround for this or is there a way to determine touches without the 4 methods or gesture recognizers? (They tend to cause a delay which isn't practical for me.) By the way, all 4 methods are implemented

uiscrollview won't cancel content touches for uisegmentedcontrol

空扰寡人 提交于 2019-12-20 03:55:17
问题 I've subclassed th UIScrollView and overriden the touchesShouldCancelInContentView: method the following way: -(BOOL)touchesShouldCancelInContentView:(UIView *)view { if ([view isKindOfClass:[UIButton class]] || [view isKindOfClass:[UISegmentedControl class]]) { return YES; } if ([view isKindOfClass:[UIControl class]]) { return NO; } return YES; } It works perfectly for UIButton, but it doesn't work for UISegmentedControl. Any help would be appreciated 回答1: Finally figured it out. Had to

TouchesEnded not working in iOS5, working fine in iOS4

萝らか妹 提交于 2019-12-14 02:19:48
问题 I have a custom scrollView with the following method implemented: - (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { //if not dragging send it on up the chain if(!self.dragging){ [self.nextResponder touchesEnded:touches withEvent:event]; }else { [super touchesEnded:touches withEvent:event]; } } And in My View Controller I have the following method: -(void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event { NSLog(@"TOUCH"); //---get all touches on the screen---

subviews are not receiving touches

谁说我不能喝 提交于 2019-12-12 19:29:47
问题 I have the main View controller which adds 2 subviews. - (void)viewDidLoad { [self init]; [super viewDidLoad]; //To shrink the view to fit below the status bar. self.wantsFullScreenLayout = YES; //We start off by displaying the background Images. [self displayMenuSceneBackground]; //Then we show the Menus. [self displayMenuSceneMenu]; } Here we add the subviews to the main View Controller. both subviews are view controllers built using interface builder. -(void) displayMenuSceneBackground{ /

How to know when the button is pressed and canceled Button pressing

大城市里の小女人 提交于 2019-12-11 08:26:43
问题 I made a button. And used the below code. But it doesn't work at all. override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { print("pressTest") btnConvert.isHidden = true } How can I know when the button is pressed and when button pressing is canceled? 回答1: Use the built-in UIButton functions - .touchDown , .touchUpInside , .touchUpOutside . Touch begin: myButton.addTarget(target, action: action, for: .touchDown) Touch ends: myButton.addTarget(target, action:

iPad Landscape messing up touches began

て烟熏妆下的殇ゞ 提交于 2019-12-10 21:52:14
问题 My app is only allowable in the landscape orientations, and it launches in landscape. Thus, the top left corner when the iPad is landscape is (0,0), so everything works fine. However, when I pick up "touchesBegan"...it isn't working properly. Only when I tap on like the right two-thirds of the iPad does it pick up the touches. I know it has something to do with the orientation, because the app is literally just blank screen with a single UIView and nothing else. It is quite simple. There are

SpriteKit SKScene missing touchesEnded

不羁岁月 提交于 2019-12-06 21:33:41
问题 I've noticed that touchesEnded don't always get delivered to an SKScene on multi touch. Depending on speed of removing fingers etc, I would permanently miss some of the touchesEnded. touchesCancelled is implemented and I added a custom UIView and put over the left side of the screen - no problems. I made a custom SKView and captured events - again no problem. It's obvious that SKScene doesn't get all the touchesEnded the SKView it's embedded in, but why? (BTW, I'm running the SKScene