如何根据给定的坐标移动UIImage

时间:2012-03-14 03:38:42

标签: iphone objective-c ios xcode

我想知道是否存在UIImage基于程序中给出的多个坐标移动的方式:一个坐标将从左到右移动10个像素 第二个坐标是继续从前面的坐标开始,从上到下移动20像素等等

1 个答案:

答案 0 :(得分:2)

您可以执行以下操作

- (IBAction) doMoveLeft : (UIImageView *) sender
{
    yourImageView=sender; //Make yourImageView globally accessible.
    [yourImageView setFrame:(X,Y,Width,Height)];
}

/*
> Increase or Decrease your X,Y as per the requirement. Make (X,Y) of int type. 
And Put them at global to access it where you need!

> At the time of showing images on your view, you can also give them dynamic 
tags to distinguish them for further use.
*/