gpt4 book ai didi

ios - iOS7 中的滑动手势控制问题

转载 作者:行者123 更新时间:2023-12-01 19:01:27 24 4
gpt4 key购买 nike

在我的应用程序中,我使用的是 Swipe Gesture Control。我有一个表格 View 和一个 View Controller 。
我的 View 设计如下:- enter image description here enter image description here
滑动时效果很好。但问题是,当快速滑动时,它有时会显示为重叠的条形按钮
enter image description here
解决方案是什么。我刚刚尝试了这段代码

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

}

我也使用代码在表格 View 中隐藏后退按钮
它不适用于我的项目。请帮助我

最佳答案

将此代码发布到 viewDidLoad 中的 View Controller 中。

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];

放置 swipeLeft: 和 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];
}

希望对你有帮助..

关于ios - iOS7 中的滑动手势控制问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22685828/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com