Question

In my application I am using Swipe Gesture Control.I have a table view and a view controller. my view design will be like :-enter image description hereenter image description here When swipe the itwill works great.but problem is that when swipe speedly it will some times display as overlapped bar buttons enter image description here What will be the solution.I just tried this code

 if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;

}

also i have used the code for hide back button in table view It Not be worked on my project.pls help me

Was it helpful?

Solution

Post this code in view controller in viewDidLoad..

UISwipeGestureRecognizer *swipeLeft =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft:)];
swipeLeft.direction =UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeLeft];

UISwipeGestureRecognizer *swipeRight =[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeRight:)];
swipeRight.direction =UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeRight];

Put methods for swipeLeft: and swipeRight:

Hope this will help you..

Code for swipeLeft: and swipeRight:

-(IBAction)swipeLeft:(id)sender
{
            CView *view =[[CView alloc]initWithNibName:@"CView" bundle:Nil];
            CATransition *animation = [CATransition animation];
            [self.navigationController pushViewController:view animated:NO];
            [animation setDuration:0.30];
            [animation setType:kCATransitionPush];
            [animation setSubtype:kCATransitionFromLeft];
            [[view.view layer] addAnimation:animation forKey:@"CView"];
}
-(IBAction)swipeRight:(id)sender
{
        EView *view =[[EView alloc]initWithNibName:@"EView" bundle:Nil];
        view.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
        [self.navigationController pushViewController:view animated:YES];;
        [view release];
}

Hope this will help you..

OTHER TIPS

Use following methods. It will call when you swipe

Hope this will help you.

- (void)swipeLeft:(UITapGestureRecognizer *)recognizer{
    // Insert your own code to handle swipe left
}
- (void)swipeRight:(UITapGestureRecognizer *)recognizer {
    // Insert your own code to handle swipe right
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top