草庐IT

uipangesturerecognizer

全部标签

ios - 在 MKMapview 上移动 MKCircle 并拖动 MKMapview

我在MKMapView上有一个MKCircle。它是用户可拖动的,但如果用户拖动圆圈外的区域,map应该会移动。-(IBAction)createPanGestureRecognizer:(id)sender{_mapView.scrollEnabled=NO;_panRecognizer=[[UIPanGestureRecognizeralloc]initWithTarget:selfaction:@selector(respondToPanGesture:)];[_mapViewaddGestureRecognizer:_panRecognizer];}-(void)respond

ios - SWRevealViewController 平移手势识别器问题

我正在使用John-Lluch的SWRevealViewController。我需要使用平移手势来查看侧边栏,并且我正在使用滑动来查看我的上一篇和下一篇文章。但是,只能检测到平移手势。更新:如果我禁用平移手势,我的滑动手势就会起作用。平移手势[self.viewaddGestureRecognizer:self.revealViewController.panGestureRecognizer];滑动手势UISwipeGestureRecognizer*left=[[[UISwipeGestureRecognizeralloc]initWithTarget:selfaction:@se

ios - 解决两个平移手势识别器之间的冲突

我有以下层次结构:查看subview每个View都分配有UIPanGestureRecognizer。外部平移手势识别器只对垂直平移感兴趣,因此我为此实现了委托(delegate)方法:-(BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer*)panGestureRecognizer{CGPointvelocity=[panGestureRecognizervelocityInView:panGestureRecognizer.view];returnfabs(velocity.y)>fabs(velocity.x);}然

ios 给view添加panGesture,改变view frame,但不流畅

我在self.view中添加了一个view,在view中添加了一个UIPangestureRecognizer,move了view,但是不流畅,感觉不流畅,这是我的代码,谢谢你帮助我varredView:UIView=UIView();varredFrame:CGRect=CGRect();overridefuncviewDidLoad(){super.viewDidLoad()redView=UIView.init(frame:CGRect.init(x:0,y:100,width:KWidth,height:40))redView.backgroundColor=UIColor.r

ios - UIPanGestureRecognizer 获取以像素为单位的滑动距离

我正在尝试使用UIPanGestureRecognizer跟踪用户滑动的水平距离,但我很难解释结果。这是我正在使用的代码:-(IBAction)handlePan:(UIPanGestureRecognizer*)recognizer{CGPointstartLocation;if(recognizer.state==UIGestureRecognizerStateBegan){startLocation=[recognizerlocationInView:self.view];}if(recognizer.state==UIGestureRecognizerStateEnded){C

ios - [ViewController gestureRecognizer :shouldRecognizeSimultaneouslyWithGestureRecognizer:]: message sent to deallocated instance

我有一个简单的场景。我将myViewController插入导航堆栈。myViewController基本上是在整个屏幕上显示一个CollectionView。我在此CollectionView上添加了一个额外的UIPanGestureRecognizer并将myViewController设置为其委托(delegate)。我在myViewController中保留了对平移手势识别器的强烈引用。当我点击返回时,myViewController从导航堆栈中弹出并释放。myViewController的dealloc方法被正确调用。到目前为止,一切都按预期工作。然后我尝试像第一次一样打开相

ios - 使用 pangesture 在父 View 中移动 UIView

我想在父View中移动一个View,我正在使用UIPanGestureRecognizer移动View。我正在使用以下代码。-(void)move:(UIPanGestureRecognizer*)recognizer{CGPointtouchLocation=[recognizerlocationInView:self.customeView];self.view.center=touchLocation;}我想使用locationInView来移动View而不是translationInView。谁能帮助我如何使用locationInView在父View中移动View?

ios - 平移手势干扰滚动

我有三个ViewController,它们是UIScrollView的一部分。我希望能够在三者之间滑动,尽管其中一个ViewController具有UIPanGestureRecognizer。我使用这个平移手势识别器允许用户上下拖动他们的手指来增加和减少矩形UIView的高度。因此,这个UIPanGestureRecognizer只需要知道向上/向下平移,ScrollView可以使用水平平移。这方面的一个例子,就像主屏幕;您可以向左或向右滑动,也可以向下滑动以获得聚光灯。我想要这种机制。这是我的平底锅代码:-(void)pan:(UIPanGestureRecognizer*)aPa

iphone - 从子类调用 UIPanGestureRecognizer touchesBegan 的警告

在UIPanGestureRecognizer的自定义子类中,当我重写touchesBegan时:-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{[[selfview].superviewbringSubviewToFront:[selfview]];[supertouchesBegan:toucheswithEvent:event];}super行收到警告:....warning:'UIPanGestureRecognizer'maynotrespondto'-touchesBegan:withEvent:'.

ios - 带有 UIScrollView 的 UIPanGestureRecognizer

我已经和UIScrollView斗争了一段时间了。我有一个ScrollView,其中有多个“卡片”样式的View。我希望卡片垂直移动,就像上下滑动一样。想象一下MobileSafari的选项卡View,但向下滑动即可关闭选项卡。我不知道如何在不与ScrollView水平平移冲突的情况下执行此操作。我要么让它们都平移,要么只平移一个(垂直/水平)。使这项工作完美的最佳实践是什么,如“如果您垂直滑动,停止水平滑动,如果您水平滑动,停止垂直滑动”。谢谢!这是我想要的示例: 最佳答案 ScrollView有自己的手势识别器:查看它的panG