如何使用UITouches移动CGRect? [英] How can I move CGRect with UITouches?
本文介绍了如何使用UITouches移动CGRect?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用uitouches移动CGRect?如果有人有想法请解释.
How can I move CGRect with uitouches? If anyone has idea please explain.
if(areaSelected)
return;
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[myPath addLineToPoint:[mytouch locationInView:self]];
[self setNeedsDisplay];
推荐答案
您好,根据我的理解,您需要将裁剪后的图像移动到另一个位置,以便在触摸内容中进行编码... >
Hi as per my understanding you need to move the cropped image to one place to other place so you need to code it in the touches stuff...
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
cloud.center = location;
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}
这里的云是UIImageView,您可以将其作为裁剪后的图像....
Here cloud is the UIImageView you can make it as cropped image ....
cloud.image=croppedImage; //[you must assign this first...]
我希望它可以帮助您...
i hope it helps you...
这篇关于如何使用UITouches移动CGRect?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文