2012-03-14 109 views
0

我想知道是否有一種方法,UIImage基於程序中給出的多個座標移動:例如,一個座標將移動10像素frm左向右 2日共同座標將是從rprevious共同座標繼續移動20個像素FRM從上到下等如何根據座標給出的座標移動UIImage

+0

一個動作你可以張貼一些例子嗎?你的問題不是很清楚.. – 2012-03-14 03:43:29

+0

更改圖像視圖的x,y位置。例如 – Ron 2012-03-14 04:39:21

+0

想象有一部電影在背景UIView中播放,還有一個男人從左到右走路並跳舞。我想把圖像放在人臉上,基於他的臉部運動,圖像必須相應地改變方向 – orgami 2012-03-14 05:27:36

回答

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. 
*/