2012-06-14 16 views
-1

我正在尋找一些幫助,我的Xcode項目。Xcode:使圖像加速然後單擊按鈕?

我想使圖像移動到特定位置,然後單擊按鈕。但它必須加速而不是移動(從開始位置消失並出現在結束位置)。所以它必須動畫。

希望你能幫助我!

非常感謝!

+0

在加速之前btn的userenteraction將爲false,但當animationDidFInished時,則btn的userenteraction將爲true。 –

回答

2

您可以使用動畫塊UIView輕鬆實現動畫到新的位置。下面的實施例..

-(void)buttonClick:(id)sender { 

      UIButton *button = (UIButton*)sender; 

      [UIView animateWithDuration:1 
         delay:0 
        options:UIViewAnimationCurveLinear 
       animations:^{ 

      [button setFrame:CGRectMake(100,100,button.frame.size.width,button.frame.size.height)]; 

       } 
       completion:^(BOOL finished){ 

       }] 

} 

這種上述方法將你的左鍵並移動到位置{100,100}上它與上海華1秒的持續時間,並與UIViewAnimationCurveLinear動畫曲線。您可以在UIView Class Reference文檔中看到動畫曲線的選項。

相關問題