[英]UITableView emerge from right on UIView
我正在嘗試制作我的第一個動畫。 目前,我正在使用animateWithDuration:animations
和transitionFromView:toView:duration:options:completion:
但是我不確定是否在“正確的頁面”中。
我想做的就是創建這樣的動畫:用戶在左上角點擊按鈕, UITableView
從屏幕的左側到達。
我從未在iOS SDK中進行過任何動畫處理,因此將不勝感激:StackOverflow中的類似問題,一些教程等。我不知道應該從哪里開始。
假設您有一個UITableView作為UIViewController視圖的子視圖。
首先,在動畫之前,將UITableView設置在屏幕外,使用center或frame屬性:
CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];
self.theTableView.frame = CGRectMake(-screenFrame.size.width, 0.0, screenFrame.size.width, screenFrame.size.height);
然后,完成動畫代碼:
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
self.theTableView.frame = CGRectMake(0.0, 0.0, screenFrame.size.width, screenFrame.size.height);
}
completion:nil];
希望對您有幫助! :D
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.