iPhone 实现地图程序效果
2010-03-25 17:01:00 来源:WEB开发网看了很多例子的CurlUp和CurlDown,都是翻页效果,没有像地图那样翻到一半停下的,偶然在网上看到了方法,自己做了一个例子,不敢独享,拿出来大家看一下。
关键代码如下:
1. - (IBAction)curlUp{
2. NSLog(@"Curl");
3. // Curl the image up or down
4. CATransition *animation = [CATransition animation];
5. [animation setDelegate:self];
6. [animation setDuration:0.35];
7. [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
8. if (!curled){
9. animation.type = @"pageCurl";
10. animation.fillMode = kCAFillModeForwards;
11. animation.endProgress = 0.58;
12. } else {
13. animation.type = @"pageUnCurl";
14. animation.fillMode = kCAFillModeBackwards;
15. animation.startProgress = 0.42;
16. }
17. [animation setRemovedOnCompletion:NO];
18. [view exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
19.
20. [view addAnimation:animation forKey:@"pageCurlAnimation"];
21.
22. // Disable user interaction where necessary
23. if (!curled) {
24.
25. } else {
26.
27. }
28.
29. curled = !curled;
30. }
更多精彩
赞助商链接