模态状态下实现背景透明效果

2017-03-03  本文已影响43人  梁大大大大大壮_

BaseShareViewController *vc = [[BaseShareViewController alloc] init];

以下是必要配置,

[vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];

self.modalPresentationStyle = UIModalPresentationCurrentContext;

self.providesPresentationContextTransitionStyle = YES;

self.definesPresentationContext = YES;

[self.navigationController presentViewController:vc animated:YES completion:^{

}];

另外,还要在layout方法里面给模态出的页面设置大小,如图

- (void) viewWillLayoutSubviews

{

self.view.frame = CGRectMake(0, 500, MainScreenSize.width, 167);

}

最后实现的效果如下图:

未完待续。。。

上一篇 下一篇

猜你喜欢

热点阅读