简体   繁体   中英

UIView Animation

I need to flip my view horizontally.

I tried to flip along with the navigation Controller when i did this my background screen becomes black

How to avoid this?

I tried this code..

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];
}];

Please try the below code :-

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];

You can avoid that black screen by changing your presentation style with below code,

Use this,

 nav.modalPresentationStyle = UIModalPresentationOverFullScreen;

OR

 nav.modalPresentationStyle = UIModalPresentationOverCurrentContext;

Hope this will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM