我怎样才能使用UITouches移动CGRect?

我怎样才能移动CGRect与uitouches? 如果有人有想法,请解释。

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)]