2012-03-30 41 views
2

在iPhone上的Google地圖應用程序中,在執行部分捲曲轉換的模式之後,buttom中的工具欄仍然可見。當我在故事板中以部分捲曲設置模態序列時,新視圖控制器將隱藏工具欄中的視圖。如何設置不隱藏工具欄的部分捲曲模式?

如何設置像Google地圖應用那樣的部分捲曲?

Google Maps on iPhone Modal in Storyboard

回答

2

你可能需要使用OpenGL ES去這一個。 Core Animation公開了使用圖層的能力,即使在3-D中也是如此,但所有圖層都只是矩形,並且它們是這樣操縱的。即使使用perspective distortion,您也可以對flipping of a layer進行動畫處理,但是您要做的曲線比使用Core Animation API管理的要複雜得多。

您可能可以將圖像拆分爲小圖層網格,然後使用CATransform3D對每個圖層進行操作以創建此彎曲效果,但此時您可能會使用OpenGL ES創建相同的效果。

3

試試看這個代碼。這會對你有幫助。 請不要猶豫,試試這個代碼

您將需要導入QuartzCore.framework。

locationMapView是你MKMapViewcurlView是你的第二個UIView

- (IBAction)curlButtonPressed:(id)sender { 

    if (isCurlStarted == NO) { 
     [UIView animateWithDuration:1.0 
         animations:^{ 
          CATransition *animation = [CATransition animation]; 
          [animation setDelegate:self]; 
          [animation setDuration:0.7]; 
          [animation setTimingFunction:[CAMediaTimingFunction functionWithName:@"default"]]; 
          animation.type = @"pageCurl"; 
          animation.fillMode = kCAFillModeForwards; 
          animation.endProgress = 0.65; 
          [animation setRemovedOnCompletion:NO]; 
          [locationMapView.layer addAnimation:animation forKey:@"pageCurlAnimation"]; 
          [locationMapView addSubview:curlView]; 
          ;} 
     ];    
     isCurlStarted = YES; 
    }else{ 
     [self curlDownPressed:curlDownButton]; 
    } 

} 

- (IBAction)curlDownPressed:(id)sender { 
    [UIView animateWithDuration:1.0 
        animations:^{ 
         CATransition *animation = [CATransition animation]; 
         [animation setDelegate:self]; 
         [animation setDuration:0.7]; 
         [animation setTimingFunction:[CAMediaTimingFunction functionWithName:@"default"]]; 
         animation.type = @"pageUnCurl"; 
         animation.fillMode = kCAFillModeForwards; 
         animation.startProgress = 0.35; 
         [animation setRemovedOnCompletion:NO]; 
         [locationMapView.layer addAnimation:animation forKey:@"pageUnCurlAnimation"]; 
         [curlView removeFromSuperview]; 

         ;} 
    ]; 
    isCurlStarted = NO; 
} 
+0

+1爲理念,以停止動畫過渡,但這種方法可以通過我證明了蘋果作爲頁面捲曲廣告素材是一個私人的API? – voromax 2012-09-16 22:27:36

+0

ofcourse yes..Why not ??我的應用程序已經在appstore :-) – 2012-09-17 10:00:10

+0

http://stackoverflow.com/a/14622113/1083859此代碼將幫助您更多。我已經優化了這些代碼併發布在那裏。 – 2013-03-26 07:12:22