mol*_*lle 9 iphone cocoa-touch touch uiview
我有Viewcontroller两个UIViews,一个名字textureView和一个objectView.
当我只有一个视图时,我使用这个来检测触摸:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSArray *allTouches = [touches allObjects];
for (UITouch *touch in allTouches)
{
gestureStartPoint = [touch locationInView:self.view];
if([touch view] == controlUIImageview){
NSLog(@"TOUCH DETECT");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样写这部分,如果我在一些事情要与之交互textureView有的在objectView?
我是否需要设置textureView和controlView到setUserInteractionEnabled:TRUE?
谢谢!
其他方法:
gestureStartPoint = [touch locationInView:self.view];
if(CGRectContainsPoint(textureView.frame, gestureStartPoint)){
...
}
if(CGRectContainsPoint(objectView.frame, gestureStartPoint)){
...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7225 次 |
| 最近记录: |