Mega gold challenge Question


I’m not able to perform swipe gesture operation in my application. Whenever I use three finger gesture in the simulator, it draws a line and no colour panel shows up. Has anyone faced the same problem and can anyone please help me out with this problem.

First I created a .xib file, with following property and action

[code]@property (nonatomic,weak) IBOutlet UIView *colorView;

-(IBAction)colorSelect:(UIButton *)sender


Now I implemented Swipe gesture recognizer

 UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipe:)];
        swipeGesture.direction = UISwipeGestureRecognizerDirectionUp;
        swipeGesture.numberOfTouchesRequired = 3;
        swipeGesture.delaysTouchesBegan = YES;
        [self addGestureRecognizer:swipeGesture];

Now I implemented a code for the method Swipe:

-(void)swipe:(UIGestureRecognizer *)gr
    CGPoint point = [gr locationInView:self];
    [self becomeFirstResponder];
    CGRect frame = CGRectMake(point.x,point.y,2,2);
    [[NSBundle mainBundle] loadNibNamed:@"ColorSelectView" owner:self options:nil];
    UIView *colorSelect = self.colorView;
    self.colorView.frame = frame;
    [self.window addSubview:colorSelect];
    [self.window setNeedsDisplay];

My problem is whenever I have a three finger swipe up,it just draws a line, and I don’t get any colour panel.


How do you perform a three-finger swipe in the simulator? Looking at some of the other posts, I don’t think this is possible so those of us using the simulator just went with a two-finger swipe to test what we’d done.


My problem is swipe gesture is not even executing. Let it be two finger or three finger, I don’t understand whether the mistake is in the code or am I using the simulator wrong.


Are you using the alt/option key to simulate a two-finger drag?


Hi, Thanks for your help, I got the output. I debugged it and rectified my mistakes. There was no problem with the swipe gesture class, but the Swipe method was troubling me. Thanks again. :slight_smile:


So what mistake were you making exactly? I’m having the same issue where my swipe: method is never getting called and all touches are being sent to touchesBegan: