如何设置部分卷曲模式不隐藏工具栏?

时间:2012-03-30 08:28:44

标签: objective-c ios cocoa-touch uiviewcontroller uistoryboard

在iPhone上的Google地图应用中,在执行部分卷曲过渡的模态后,仍会看到按钮中的工具栏。当我在故事板中使用部分卷曲设置模态设置时,新的视图控制器将从parant视图中隐藏工具栏。

如何设置像谷歌地图应用程序一样的局部卷曲?

Google Maps on iPhone Modal in Storyboard

2 个答案:

答案 0 :(得分: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;
}

答案 1 :(得分:2)

你可能需要使用OpenGL ES。 Core Animation暴露了使用图层的能力,即使在3-D中也是如此,但是所有图层都只是矩形,因此它们会被操纵。即使使用flipping of a layer,您也可以围绕轴设置perspective distortion的动画,但是您想要做的弯曲比使用核心动画API管理的更复杂。

您可以将图像分割成一个小图层网格,然后使用CATransform3D操作每个图像以创建这种弯曲效果,但此时您也可以使用OpenGL ES创建相同的效果。