1
HI。我试图移动一个UIImageView
对象与UITouch
和有问题的代码我如何实现UITouch只检测我的UIImageView对象?使用UITouch检测特定对象
** imageA它在我的UIImageView
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *toucheA = [[event allTouches] anyObject];
if ([toucheA view] == imageA) {
CGPoint location = [toucheA locationInView:self];
imageA.center = location;
}
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
CGPoint postion = imageA.center;
imageA.center = postion;
postion.y = 230;
imageA.center = postion;
}
但不工作!