Objective c UINavigationController—;通过presentViewController呈现时,推送和弹出之间的左右翻转动画
假设你有:Objective c UINavigationController—;通过presentViewController呈现时,推送和弹出之间的左右翻转动画,objective-c,ipad,uinavigationcontroller,uiviewanimation,Objective C,Ipad,Uinavigationcontroller,Uiviewanimation,假设你有: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after appl
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *rootViewController = [[UIViewController alloc] init];
rootViewController.view.backgroundColor = [UIColor whiteColor];
[self.window setRootViewController:rootViewController];
[self.window makeKeyAndVisible];
UINavigationController *modal = [[UINavigationController alloc] initWithRootViewController:[[PTFrontViewController alloc] init]];
modal.modalPresentationStyle = UIModalPresentationFormSheet;
[rootViewController presentViewController:modal animated:YES completion:NULL];
return YES;
}
鉴于此示例,PTFrontViewController
和PTBackViewController
视图控制器没有什么有趣的地方
如何从PTFrontViewController
中推送PTBackViewController
的实例,如uiviewmanimationtransitionflipfromlight
或uiviewmanimationtransitionflipfromright
中的动画
我已经很清楚这三件事:
presentViewController
UINavigationController
的默认动画有一个很好的理由presentViewController
显示视图控制器时,会出现无法正确设置动画的阴影和背景视图所以请记住这些事情。谢谢。首先-忘记
UINavigationController
。如果不需要默认动画,只需在控制器中插入UINavigationBar
。这会变得容易一点
第二,这是一个困难的问题,您不能仅在模态控制器中创建这样的动画,因为背景不会被重新绘制
诚恳地说,我看到的最简单的解决方案就是忘记模态控制器,只需将视图控制器添加为根控制器的子控制器。然后,您可以控制所有动画,但您必须自己编写所有内容(包括背景淡入淡出)