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


目录
相关文章
|
6月前
|
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...]
679 0
App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW in
App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW in
121 0
|
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***
156 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 =
350 0
|
Android开发
解决 error: style attribute '@android:attr/windowEnterAnimation' not found.
解决 error: style attribute '@android:attr/windowEnterAnimation' not found.
179 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...
1094 0
|
安全 Java Android开发
PhotoSharing Part I: Setting up the Photo Sharing Android Application
We will build a photo sharing Android app with real-time image uploading and downloading functionality using Alibaba Cloud OSS.
1786 0