看了很多例子的CurlUp和CurlDown,都是翻页效果,没有像地图那样翻到一半停下的,偶然在网上看到了方法,自己做了一个例子,不敢独享,拿出来大家看一下。
- (IBAction)curlUp{ NSLog(@"Curl"); // Curl the image up or down CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:0.35]; [animation setTimingFunction:UIViewAnimationCurveEaseInOut]; if (!curled){ animation.type = @"pageCurl"; animation.fillMode = kCAFillModeForwards; animation.endProgress = 0.58; } else { animation.type = @"pageUnCurl"; animation.fillMode = kCAFillModeBackwards; animation.startProgress = 0.42; } [animation setRemovedOnCompletion:NO]; [view exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [view addAnimation:animation forKey:@"pageCurlAnimation"]; // Disable user interaction where necessary if (!curled) { } else { } curled = !curled; }