我有一个问题要处理iPhone的数字操纵杆:
他们的操纵杆 - innerThumb - 移动到你触摸显示屏的位置。 但它只应该开始移动,当你使用thumbPic时。
守则:
- (void)makeHandle {
self.handle = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 64, 64)];
[self.handle setCenter:CGPointMake(self.bounds.size.width/2,
self.bounds.size.height/2)];
self.defaultPoint = self.handle.center;
[self roundView:self.handle toDiameter:self.handle.bounds.size.width];
[self addSubview:self.handle];
self.thumbImageView = [[UIImageView alloc] initWithFrame:self.handle.frame];
[self addSubview:self.thumbImageView];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[UIView animateWithDuration:.2 animations:^{
self.alpha = 1;
}];
[self touchesMoved:touches withEvent:event];
}
所以我的想法是这样的 - 在tochesBegan我问:
for (UITouch *touch in touches) {
if (touch == self.handle.thumbImageView) {
[self touchesMoved:touches withEvent:event];
}
}
但是UiTouch和UIImageView不等于类型 - 我知道
有人有想法吗?
格尔茨