我想滚动UIImageView中的图像,以防手指位于UIImageView区域内,并且我正在移动手指。我试图用目标c来做到这一点。我知道它移动了,但它很奇怪,并且不正确。你能告诉我怎么做,请?滚动UIImageView图像
这是我在做什么:
- (void)touchesMoved :(NSSet *)touches withEvent:(UIEvent *)event{
for (UITouch *touch in touches) {
CGPoint touchLocation = [touch locationInView:self];
for (id sublayer in view_shape.sublayers) {
if (sublayer ==imageView.layer) {
if (CGRectContainsPoint(imageView.frame, touchLocation)) {
imageView.layer.contentsRect = CGRectMake(touchLocation.x/1000,
touchLocation.y/1000,
imageView.layer.contentsRect.size.width,
imageView.layer.contentsRect.size.height);
}
}
}
}
}
我想避免这种情况,因为我想看看是否有可能与imageView –
为什么我这样做是因为如果我有一些对象上方滚动我不能点击它们 –