[英]How can I move CGRect with UITouches?
如何使用uitouches移動CGRect? 如果有人有想法請解釋。
if(areaSelected)
return;
UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
[myPath addLineToPoint:[mytouch locationInView:self]];
[self setNeedsDisplay];
嗨,根據我的理解,您需要將裁剪后的圖像移到另一個位置,因此需要在觸摸內容中進行編碼...
-(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,您可以將其作為裁剪的圖像....
cloud.image=croppedImage; //[you must assign this first...]
我希望它可以幫助您...
您需要重置矩形框:
[cropRect setFrame:CGRectMake(<new x coordinate>, <new y coordinate>, width, height)]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.