您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页新的Controller背景透明

新的Controller背景透明

来源:伴沃教育

在做项目的时候,需要将一个新的controller盖到上层controller上,而且新的controller背景是半透明的,可以显示出上层controller的内容。为实现这一需求,需要在present新的controller的时候,这样写:

NewViewController *vc = [[NewViewController alloc]init];
self.definesPresentationContext = YES; //self is presenting view controller
vc.view.backgroundColor = [UIColor clearColor];
vc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:vc animated:NO completion:nil];

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务