the content is displayed over another view controller’s content

简介: the content is displayed over another view controller’s content

前言

需求:将当前的VC的界面作为另一个VC的背景图片(在当前视图中推出另外一个背景透明的视图控制器)

具体的应用场景(下单的的付款详情、发布商品的选择商品类目、反馈页面)

image.png

实现思路:

  1. 使用系统自带的modal样式:UIModalPresentationOverCurrentContext- A presentation style where the content is displayed over another view controller’s content
  2. 截取当前屏幕

I 、实现方案

推荐使用系统自带的modal样式实现需求,因为性能更好,实现也简单

1.1 使用系统自带的modal样式

设置modalPresentationStyle为UIModalPresentationOverCurrentContext,并设置蒙版颜色

CategoryViewController *tmp = [CategoryViewController new];
    tmp.modalPresentationStyle = UIModalPresentationOverCurrentContext;
        //设置蒙版颜色
    [tmp view].backgroundColor = STModalWindowDefaultBackgroundColor;
   [self.navigationController presentViewController:tmp animated:YES completion:^{
    }];

子视图背景颜色可根据需要为clearColor,或者其他颜色。

- (void)viewDidLoad {
    [super viewDidLoad];
    //设置VCView背景颜色为clearColor
    [self vcView].backgroundColor =[UIColor clearColor] ;
}

效果:发布商品的选择商品类目

image.png

下载地址:https://download.csdn.net/download/u011018979/19775162

文章地址:https://kunnan.blog.csdn.net/article/details/106553175

视频地址:https://live.csdn.net/v/167208

商品经营类目选择视图的应用场景: 1、发布商品时选择商品类目 2、商户进件选择经营类目 3、购物类app下单界面的商品类目筛选

1.2 截取当前视图

反馈页面自动生成截图

注意:截图在弹反馈页面之前create【原理文章】(https://kunnan.blog.csdn.net/article/details/113444297)

image.png

image.png

see also


目录
打赏
0
0
0
0
5
分享
相关文章
|
7月前
|
Stylelint—— Expected class selector ".nut-popup--top" to be kebab-case selector-class-pattern
新项目制定规范接入了stylelint,并通过husky在git提交时去触发检测修复,因为使用的是NutUi,所以无法直接调整组件对应的类名称,只好在stylelint.config.js中加入相应的rules进行配置。
186 0
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
Could not extract response: no suitable HttpMessageConverter found for ..content type [text/html...]
884 0
xml文件报错Element ‘beans‘ cannot have character [children), because the type‘s content type is element-
xml文件报错Element ‘beans‘ cannot have character [children), because the type‘s content type is element-
xml文件报错Element ‘beans‘ cannot have character [children), because the type‘s content type is element-
【Android】解决TextView.setText提示Do not concatenate text displayed with setText. Use resource string
【Android】解决TextView.setText提示Do not concatenate text displayed with setText. Use resource string =
367 0
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等