我想UIImageView
在主视图上的每次点击时动态创建,并且还想移动UIImageView
由手指移动创建的所有内容。我在每次触摸时都成功地进行了动态创建,我的代码如下:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint pt = [touch locationInView:self.view];
imgView = [[[UIImageView alloc] initWithFrame:CGRectMake(pt.x,pt.y, 100, 100)] autorelease];
imgFilepath = [[NSBundle mainBundle] pathForResource:@"img" ofType:@"png"];
img = [[UIImage alloc] initWithContentsOfFile:imgFilepath];
imgView.tag=i;
[imgView setImage:img];
[img release];
[self.view addSubview:imgView];
}
现在我想移动任何UIImageView
由手指运动动态创建的东西。谢谢。