Presenting a modal view controller over only one half of a split view controller

核能气质少年 提交于 2019-12-04 19:10:31
UIViewController *viewController = [[UIViewController alloc] init];
viewController.modalPresentationStyle = UIModalPresentationCurrentContext;

[self presentViewController:viewController animated:YES completion:nil];

Probably you can just add its view as as a subview of DetailViewcontroller and use UIview animation to make it look like modal. Reference to [UIView transitionFromView:toView:duration:options:completion]

EDIT When watching WWDC2010 Video (Session 123 : Building Animation Driven Interfaces), I accidentally came to know that I can do the same transition in different manner. I sample coded and it worked :)

It is to use another very similar API [UIView transitionWithView:duration:options:animations:completion:]

My sample code is as follows

// Within your DetailViewController
[self.view addSubview:self.flipSideView];
[UIView transitionWithView:self.view duration:0.8 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{} completion:nil];

Yup, that was it. Just add the flip side view as a subview and use transitionWithView:... animation instead of transitionFromView....

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!