2012-04-18 109 views

回答

0

您可以嘗試的touchesBegan事件下面的代碼:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    if([touch view] ==self.my_view)//Check click your uiview or not 
    { 
     CGRect frame = [your_image_view frame]; 
     CGPoint touchLocation = [touch locationInView:touch.view]; 
     frame.origin.x=touchLocation.x; 
     frame.origin.y=touchLocation.y; 
     [your_image_view setFrame:frame]; 
     [self.my_view addSubview:your_image_view]; 
    } 

} 

謝謝..!

+0

我知道了,謝謝! – user49336 2012-04-18 13:05:18

0

那麼,第一步將檢測您的UIView觸摸,我會建議使用高級API UIGestureRecognizer和添加到您的視圖。那麼你可以使用回撥來做你想做的事情,也許是某種動畫?如果是這樣,您可以使用動畫塊來更改動畫。

+0

感謝您的諮詢! – user49336 2012-04-18 13:06:34