2012-05-14 84 views
0

我正在創建一個應用程序,在該應用程序中,當用戶單擊任何對象並且用戶點擊UIView時,該圖像應該放在視圖上,然後在任何方向上拖動該圖像它應該重新調整大小。 任何人有任何想法做到這一點,請讓我知道。 或我可以得到任何示例代碼?拖動圖像並調整它們的觸摸大小(iPhone)

感謝

+0

我已經begintouch,移動和endtouch工作,但沒有關於從視圖中下降的對象到另一個地方的想法,如何重新調整大小,我也知道如何在單個視圖中拖放對象。 –

回答

0
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 

{ 

UITouch *touch = [[event allTouches] anyObject]; 

CGPoint touchLocation = [touch locationInView:self.view]; 

if ([touch view] == photo) { 

photo.center = touchLocation; 

} 

else if ([touch view] == photo1) { 

    photo1.center = touchLocation; 

} 

} 

,或者你可以在鏈接看到http://www.roseindia.net/tutorial/iphone/examples/iphone-DoubleImageMoveasd.html

+0

Hello Jay這段代碼適用於拖放同一視圖內的對象,但我想要從另一個視圖中選擇對象並將其放到另一個視圖中。 –

+0

不起作用,這是一個有點原始的問題 –

相關問題