我想在屏幕上多次移動ImageView,直到現在我找到了兩種方法。但我不確定哪一個更有效率,或者兩者是相同的。請,我能有一些建議嗎?謝謝。哪種方式更好地移動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;