2011-05-16 82 views
0

製作遊戲主菜單的最佳方式是什麼?我寧願它是UIButtons。更具體地說,什麼是動畫按鈕的最佳方式?例如,在進入按鈕的視圖加載時的動畫,然後當選擇菜單選項時按鈕出去,然後新的按鈕(子菜單)動畫回來。我以前從未做過任何動畫,所以我想知道最好的方法。感謝製作動畫主菜單

回答

0

這種類型的動畫是非常容易使用的UIKit:

[UIView animateWithDuration:0.5 animations:^{ 
    button1.frame = <new frame>; 
    button2.frame = <new frame>; 
}]; 

這將來自當前幀的動畫幀,以在給定持續時間(0.5秒)指定的幀。如果當前幀在屏幕外並且新幀是您想要的最終位置,則這些按鈕將在0.5秒內移動到正確的位置。

的UIView的下列性能以這種方式是動畫:

  • 界限
  • 中心
  • 變換
  • 阿爾法
  • 的backgroundColor
  • contentStretch

Animations section of the View Programming Guide有更多信息。