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


目录
相关文章
|
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 =
309 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***
121 0
Could not find class 'android.support.v4.view.ViewPager', referenced from method***
|
JavaScript 前端开发
sendData to ABAP backend via multiple form content type
Created by Jerry Wang, last modified on Aug 20, 2014
sendData to ABAP backend via multiple form content type
Access context of data source and work center view do not match
这个错误消息提示我们,data source的access context和待分配到工作中心的access context必须匹配:
Access context of data source and work center view do not match
data-sap-ui-icon-content where does icon content come from
Created by Wang, Jerry, last modified on Feb 11, 2015
data-sap-ui-icon-content where does icon content come from
|
安全 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.
1751 0