我想在屏幕上多次移动 ImageView,直到现在我找到了两种方法。但是我不确定哪个更有效,或者两者可能相同。拜托,我可以给点建议吗?谢谢。
// Create ImageView and add subview
UIImageView imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
imgView.frame = CGRectMake(0, 0, image_width, image_height);
[[self view] addSubview:imgView];
[imgView release];
// New Coordinates
int xNew = 100;
int yNew = 130;
// First way to move ImageView:
imgView.frame = CGRectMake(xNew, yNew, image_width, image_height);
// Second way to move ImageView:
CGPoint center;
center.x = xNew;
center.y = yNew;
imgView.center = center;