简体   繁体   English

iOS7中的滑动手势控制问题

[英]Issue with Swipe Gesture Control in iOS7

In my application I am using Swipe Gesture Control.I have a table view and a view controller. 在我的应用程序中,我使用Swipe Gesture Control。我有一个表视图和一个视图控制器。 my view design will be like :- 我的视图设计将如下: - 在此输入图像描述在此输入图像描述 When swipe the itwill works great.but problem is that when swipe speedly it will some times display as overlapped bar buttons 当滑动它会很好。但问题是,当快速滑动时,它会显示为重叠的条形按钮 在此输入图像描述 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 我也在表视图中使用了隐藏按钮的代码它不能在我的project.pls帮助我

Post this code in view controller in viewDidLoad.. 在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: 为swipeLeft:和swipeRight设置方法:

Hope this will help you.. 希望这个能对您有所帮助..

Code for swipeLeft: and swipeRight: swipeLeft的代码:和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.. 希望这个能对您有所帮助..

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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM