[英]UIView Animation
我需要水平翻轉視圖。
當我這樣做時,我嘗試與導航控制器一起翻轉,背景屏幕變黑
如何避免這種情況?
我嘗試了這段代碼。
HomeViewController *homeVC = [[HomeViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:homeVC];
nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
nav.modalPresentationStyle = UIModalPresentationFormSheet;
[[self navigationController] presentViewController:nav animated:YES completion:^{
[Constants showHomeScreenOnViewController:self];
}];
請嘗試以下代碼:-
UIViewController *controller = [[[MyViewController alloc] init] autorelease];
UIViewAnimationTransition trans = UIViewAnimationTransitionCurlUp;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [self window] cache: YES];
[navController presentModalViewController: controller animated: NO];
[UIView commitAnimations];
您可以通過以下代碼更改演示樣式來避免黑屏,
用這個,
nav.modalPresentationStyle = UIModalPresentationOverFullScreen;
要么
nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;
希望這會幫助你。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.