我正在尝试在ViewController
之间创建翻转动画,但它不起作用:
BHAppDelegate *app = [[UIApplication sharedApplication] delegate];
UINavigationController *tabBarController = [self.storyboard instantiateViewControllerWithIdentifier:@"NavigationController"];
BHViewController *leftViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenu"];
PKRevealController *revealController = [PKRevealController revealControllerWithFrontViewController:tabBarController leftViewController:leftViewController];
[revealController setMinimumWidth:220 maximumWidth:220 forViewController:tabBarController];
[UIView beginAnimations:@"animation" context:nil];
app.window.rootViewController = revealController;
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO];
[UIView commitAnimations];
答案 0 :(得分:0)
很抱歉,为什么要在UIWindow上将revealController
设置为rootViewController
?
我认为上面的代码在你的rootViewController
中,所以从你的rootViewController你应该用这种方式来呈现revealController
:
[revealController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:revealController animated:YES completion:nil];
在revealController
中你会用这种方式解散并回到rootViewController
:
[self dismissViewControllerAnimated:YES completion:nil];