How to setup a partial curl modal not hiding toolbar?

♀尐吖头ヾ 提交于 2020-01-13 20:20:07

问题


In the Google Maps app on iPhone, the toolbar in the buttom is still visible after the modal with a partial curl transition is preformed. When I setup a modal seque in my storyboard with a partial curl, the new view controller is hiding the toolbar from the parant view.

How can I setup a partial curl like the Google Maps app?


回答1:


You'll probably need to go with OpenGL ES for this one. Core Animation exposes the ability to work with layers, even in 3-D, but all layers are just rectangles and they are manipulated as such. You can animate the flipping of a layer about an axis, even with a perspective distortion, but the kind of curving you want to do is more complex than you can manage using the Core Animation APIs.

You might be able to split your image up into a mesh of tiny layers and manipulate each using a CATransform3D to create this curving effect, but at that point you might as well be using OpenGL ES to create the same effect.




回答2:


Try this code.This will be helpful to you.PLEASE DON'T HESITATE TO TRY THIS CODE.

You will need to import a QuartzCore.framework.

locationMapView is your MKMapView and curlView is your second 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;
}


来源:https://stackoverflow.com/questions/9939439/how-to-setup-a-partial-curl-modal-not-hiding-toolbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!