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


目录
相关文章
|
7月前
|
JSON Java 数据格式
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...]
779 0
modified: (modified content, untracked content)
modified: (modified content, untracked content)
125 0
modified: (modified content, untracked content)
|
Java
Could not find class 'android.support.v4.view.ViewPager', referenced from method***
Could not find class 'android.support.v4.view.ViewPager', referenced from method***
162 0
Could not find class 'android.support.v4.view.ViewPager', referenced from method***
|
Android开发
【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 =
357 0
|
C#
C#: Get current keyboard layout\input language
原文 https://yal.cc/csharp-get-current-keyboard-layout/   On some occasions, you may want to get a "global" input language - that is, the keyboard layo...
1100 0

热门文章

最新文章