开发者

Dismiss modalviewcontroller with a page curl

开发者 https://www.devze.com 2022-12-21 22:36 出处:网络
I am trying to dismiss a modalviewcontroller with a page curl. The curl works okay but I cannot seem to get the tableview under the modalviewcontroller to show up. The image of the modalviewcontroller

I am trying to dismiss a modalviewcontroller with a page curl. The curl works okay but I cannot seem to get the tableview under the modalviewcontroller to show up. The image of the modalviewcontroller is still under the curled away page. If I dismiss the modalviewcontoller before the animation finishes the animation doesn't show up. Here is my code:

//hide splash scree开发者_如何学编程n
- (void)hideSplash{
 [UIView beginAnimations:nil context:nil];
 //change to set the time
 [UIView setAnimationDuration:2];
 [UIView setAnimationBeginsFromCurrentState:YES];
 [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:modelView cache:NO];
 // do your view swapping here

 //[[self modalViewController] dismissModalViewControllerAnimated:NO];

 [UIView commitAnimations];
//[self.view  sendSubviewToBack:self.view]; 

}

Hope someone can help! Cheers Nick


In iOS4:

To present, it's something like:

[containerView addSubview:modelView];
[UIView transitionWithView:containerView
                  duration:.75
                   UIViewAnimationOptionTransitionCurlUp
                animations:^{}
                completion:^(BOOL finished) {
                    NSLog(@"finished %d", finished);
                }];

To dismiss, use UIViewAnimationOptionTransitionCurlDown.


Your setAnimationTransition: shouldn't be forView:modelView; it should be for the parentView.

[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:containerView cache:NO];

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html

If you want to change the appearance of a view during a transition—for example, flip from one view to another—then use a container view, an instance of UIView, as follows:

  • Begin an animation block.
  • Set the transition on the container view.
  • Remove the subview from the container view.
  • Add the new subview to the container view.
  • Commit the animation block.

Use of this method is discouraged in iOS 4.0 and later. You should use the block-based animation methods instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消