之前看到的一些翻页效果的代码,解释挺清楚的
[UIView beginAnimations:@"FlipAnim" context:NULL];// 動畫開始
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft
forView:[self superview] cache:YES];// 翻轉效果
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; // 動畫時間曲線
[UIView setAnimationDuration:0.5f];// 動畫時間
// 將兩個已加入的View切換
[[self superview] exchangeSubViewAtIndex:0 withSubviewAtIndex:1];
[UIView commitAnimations];// 動畫結束
可以使用的轉換效果如:
UIViewAnimationTransitionFlipFromRight:從右邊翻轉到左邊(右邊在上左邊在下)
UIViewAnimationTransitionFlipFromLeft:從左邊翻轉到右邊(左邊在上右邊在下)
UIViewAnimationTransitionCurlUp:往上翻頁(如同Google Map右下角的翻頁按鈕)
UIViewAnimationTransitionCurlDown:往下翻頁
UIViewAnimationTransitionNone:無任何效果
iOS翻页动画
本文介绍了一种使用Objective-C实现的iOS应用中翻页动画的方法。通过UIView动画API,可以轻松地为视图添加从左到右或从右到左的翻转效果。此外,还提供了其他几种翻页过渡效果,例如向上翻页和向下翻页。
676

被折叠的 条评论
为什么被折叠?



