xǝlɐ
xǝlɐ

Reputation: 63

iPhone App: Can the Partial Curl Segue Effect be modified to go up all the way? Or for the curl to disappear?

I made a basic app with two View Controllers that can segue back and forth to each other. As my app is sort of formatted like a calendar.

I like the "Partial Curl" Effect, but when I, from my second view, click "Back" to (duh) go back to the main screen, the little curl at the top of the screen remains there.

As I go back and forth between views, the curls at the top of screen build up, with the shadows getting darker and obscuring portions of both views.

Is there any way to modify the segue animation so that no curl is left on the screen?

I have seen options for the curl effect that make it 'reverse', but I just want the curl to disappear. Thanks.

I haven't the rep to post pictures, but here are screenshots of an example of this happening, hosted on Google Drive.

Upvotes: 0

Views: 156

Answers (2)

Lord Zsolt
Lord Zsolt

Reputation: 6557

You have two segues instead of one. So A shows B, but instead of B going back to A, it creates another instance of A and shows that.

So your navigation stack will end up like: A-B-A-B-A-B-A etc.

Instead of B creating a new instance of A, it should go back to the previous A instance, thus your navigation stack should never be greater than 2.

Based on Leo Natans answer. you should instead be doing something like:

In A, when showing second view controller, B.

[UIView transitionWithView:self.view
                      duration:0.3
                       options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
                    animations:^{
                        [self presentViewController:targetVC animated:NO completion:nil];
                    }
                    completion:^(BOOL finished){
                        //...
                    }];

In B, when going back to A.

[UIView transitionWithView:self.view
                      duration:0.3
                       options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
                    animations:^{
                        [self dismissViewControllerAnimated:YES completion:nil];
                    }
                    completion:^(BOOL finished){
                        //...
                    }];

Upvotes: 0

Léo Natan
Léo Natan

Reputation: 57060

Try something like this custom transition:

[UIView transitionWithView:self.view
                      duration:0.3
                       options:UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionCurveEaseInOut
                    animations:^{
                        [self presentViewController:targetVC animated:NO completion:nil];
                    }
                    completion:^(BOOL finished){
                        //...
                    }];

You can apply this both ways when presenting and dismissing.

You can also implement this using custom transitioning delegates using the new iOS7 presentation API.

Upvotes: 1

Related Questions