草庐IT

Touchesbegan

全部标签

ios - animateWithDuration 和 touchesBegan 不能成对工作

当我的对象在我的屏幕上移动时,我需要处理触摸。当调用touchesBegan时,我需要隐藏我的对象。这是我在UIViewController中的代码:-(void)win{for(NSIntegeri=1;i 最佳答案 也许您缺少AllowAnimatedContent。尝试改变你的UIViewAnimationOptionAllowUserInteraction到UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionAllowAnimatedContent..

iphone - 为什么我的 UITableView 没有响应 touchesBegan?

我正在用这个方法-(void)tableView:(UITableView*)tableViewtouchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{UITouch*touch=[[eventallTouches]anyObject];if([myPickerViewisFirstResponder]&&[touchview]!=myPickerView){[myPickerViewresignFirstResponder];}[supertouchesBegan:toucheswithEvent:event];}但我的tableV

iphone - 在 subview (UIWebView) 上获取 touchesBegan

我有一个UIWebView,它作为subview添加到UIview中,我想检测此UIWebView何时被触摸,但touchesBegan不起作用。有什么想法吗? 最佳答案 在您的代码中子类化UIWebView,然后在您的类中实现touchesBegan。将子类化的webview添加为UIView的subview。在子类化的UIWebView中调用super-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{[supertouchesBegan:toucheswit

ios - 如何保存 touchesBegan touchLocation 值

如何保存touchesBegan值。我正在使用UItouch移动5个UIImageView,当您将imageView放在正确的位置时,imageView会保持在正确的位置。但是如果你没有把它放在正确的位置,imageView应该跳回到touchesBegan位置。这是我使用的一些代码:ViewDidLoad:[superviewDidLoad];//Doanyadditionalsetupafterloadingtheview.//CreateanarraywiththerectanglesusedfortheframesNSMutableArray*indexArray=[NSMut

objective-c - 自定义 UIView 委托(delegate)未检测到 touchesBegan

我做了研究,但没有找到以下问题的答案:我有一个自定义委托(delegate)(UIView的子类),由于某种原因,touchesBegan在委托(delegate)实现中不起作用。TestView.h#import@classTestView;@protocolTestViewDelegate@end@interfaceTestView:UIView@property(assign)iddelegate;@endTestView.m#import"TestView.h"@implementationTestView@synthesizedelegate=_delegate;-(void

iphone - 如何在 touchesBegan、touchesEnded 中实现 Touch Up Inside

我想知道是否有人知道如何在用户按下然后在touchesBegan、touchesEnded方法中抬起手指时实现“触摸内部”响应。我知道这可以用UITapGestureRecognizer来完成,但实际上我正在尝试让它只在快速点击时起作用(使用UITapGestureRecognizer,如果你握住你的手指在那里很长一段时间,然后抬起,它仍然执行)。有人知道如何实现吗? 最佳答案 使用UILongPressGesturizer实际上是一个更好的解决方案来模拟UIButton的所有功能(touchUpInside,touchUpOuts

ios - touchesBegan 之后调用的 viewDidLayoutSubviews - 一次又一次

在aniPhonewordgame我有一个UIScrollView(持有UIImageView)和7个可拖动的自定义UIView最初放置在底部(在ScrollView之外):中单ViewController.m我已经覆盖了viewDidLayoutSubviews,以便它始终设置ScrollView的zoomScale-让UIImageView正好填充100%的屏幕宽度。这适用于纵向和横向模式。当应用程序刚刚启动时:我的问题然而,当我首先捏/缩放/双击ScrollView然后移动七个Tile.m中的一个时。观点:touchesBegan之后突然(不是每次)调用viewDidLayout

ios - 如何检测来自另一个类的 touchesBegan、touchesMoved、touchesEnded 事件

我需要使用触摸事件,但我正在尝试从另一个类检测它,所以如果触摸或移动等,我会回调到我的主类。我首先从我的主类调用“classTouchEvents”中的init方法objectTouchEvents=[[classTouchEventsalloc]initWith:self.view];这里是“classTouchEvents”的initWith方法-(id)initWith:(UIView*)selfView{self=[superinit];if(self){NSLog(@"here");view=[[UIViewalloc]init];view=selfView;//Custom

iphone - subview 阻止父 View TouchesBegan?

我有一个View,它有一个UITableView作为subview,它完全覆盖了父View。当我尝试为父View实现touchesBegan时,我注意到根本没有调用该方法。无论如何要覆盖此行为? 最佳答案 实际上有一种方法可以覆盖这种行为。您需要扩展每个阻塞父View的子对象并重写touchesBegan方法,如下所示:-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{[supertouchesBegan:toucheswithEvent:event];[sel

iphone - touchesbegan、touchesmoved、touchesended 问题

出于各种原因,我已将这些方法从UIView子类移至我的ViewController。我终于让它工作了,除了一件事。我不仅能够拖动以编程方式创建的UIImageview,而且实际的ViewControllerView也是可拖动的。造成如此多的不良影响。我想这是因为它触及了任何物体,而背景本身就是一个物体。我只是不确定如何排除背景。我认为它需要“启用UserInteraction”,但我想不是吗?我只希望它使UIImageViews可拖动。请原谅我的菜鸟。我还在学习。我在名为“letterDictionary”的NSMutableDictionary中拥有所有我想要“可触摸”的ImageV