RecommandViewController *recommandVC = [[RecommandViewController alloc]init];
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0){
recommandVC.modalPresentationStyle=
UIModalPresentationOverCurrentContext|UIModalPresentationFullScreen;//if the controller has container like navigationcontroller or tababr controlelr,if you don`t use the UIModalPresentationFullScreen the bar will cover the viewcontroller
[FindAppDelegate().window.rootViewController presentViewController:recommandVC animated:NO completion:^{
recommandVC.view.backgroundColor=[UIColor clearColor];//you can figure any transparent here
}];
}else{
FindAppDelegate().window.rootViewController.modalPresentationStyle=
UIModalPresentationCurrentContext|UIModalPresentationFullScreen;//you must use the rootViewController if the system version under the iso 8.0 or the background will be black
[FindAppDelegate().window.rootViewController presentViewController:recommandVC animated:YES completion:^{
recommandVC.view.backgroundColor=[UIColor clearColor];
}];
}

主要代码:

vc.modalPresentationStyle = UIModalPresentationCustom;

present一个半透明的ViewController的方法的更多相关文章

  1. 在iOS上present一个半透明的viewController

    UIViewController *viewController = [[UIViewController alloc]init]; UIViewController* controller = se ...

  2. presentModalViewController方法,present一个透明的viewController,带动画效果

    //假设需要被present的控制器实例为controller,controller的背景色设置为clearColor UIViewController * rootcontroller = self ...

  3. iOS连续dismiss几个ViewController的方法

    原文链接:http://blog.csdn.net/longshihua/article/details/51282388 presentViewController是经常会用到的展现ViewCont ...

  4. Attempt to present <TestViewController2: 0x7fd7f8d10f30> on <ViewController: 0x7fd7f8c054c0> whose view is not in the window hierarchy!

    当 storyboard里面的 按钮 即连接了 类文件里面的点击方法  又  连接了   storyboard里 另一个  控制器的  modal 就会出现类似Attempt to present & ...

  5. viewController启动方法分析

    viewController启动方法分析 转载:http://blog.csdn.net/dizzthxl/article/details/14170047 首先理清楚一个概念: 创建一个类和实例化一 ...

  6. 错误:Warning: Attempt to present <UIAlertController: 0x7fd192806e20> on <ViewController: 0x7fd1928048d0> whose view is not in the window hierarchy!

    系统:mac OS  10.12 (16A323) Xcod:8.3.3 错误:Warning: Attempt to present <UIAlertController: 0x7fd1928 ...

  7. Java中是否可以调用一个类中的main方法?

    前几天面试的时候,被问到在Java中是否可以调用一个类中的main方法?回来测试了下,答案是可以!代码如下: main1中调用main2的主方法 package org.fiu.test; impor ...

  8. springmvc2 一个控制器写多个方法(非注解方式)

    出处:http://blog.csdn.net/xuewenke/article/details/23895999 springmvc2 一个控制器写多个方法(非注解方式) 分类: spring 20 ...

  9. 一个Java复制目录的方法(递归)

    /** * 将目标目录复制为指定目录(也可以用于复制文件) * @param src 源路径 * @param dest 目标路径 * @throws IOException */ public st ...

随机推荐

  1. 【原】文本图片自适应高度小bug以及解决办法

    自定义cell的文本图片自适应高度代码,如果存在自定义的cell赋值封装,就必须将自适应高度代码写在这个方法中

  2. linux建立ssh信任关系

    一.建立SSH信任将A主机做为客户端(发起SSH请求 ip:192.168.200.170)将B主机作为服务器端(接收ssh请求   ip:192.168.200.149)以上以主动发起SSH登录请求 ...

  3. BZOJ4113 : [Wf2015]Qanat

    设$f_i$表示用$i$个辅助井时代价的最小值,$x_i$表示此时最后一个辅助井的位置. 则$f_i$是关于$x_i$的一个二次函数,其中系数跟$f_{i-1}$有关,递推求出极值点即可. 时间复杂度 ...

  4. Node.js 手册查询-5-Ejs 方法

    express 中使用 //设置模板目录 app.set('views', path.join(__dirname, 'views')); //设置模板引擎 app.set('view engine' ...

  5. Notification Once

    Notification Once 前段时间整理项目中的AppDelegate,发现很多写在- application:didFinishLaunchingWithOptions:中的代码都只是为了在 ...

  6. Windows环境下的NodeJS+NPM+Bower安装配置步骤

    Windows下的NodeJS安装是比较方便的(v0.6.0版本之后,支持windows native),只需要登陆官网(http://nodejs.org/),便可以看到首页的“INSTALL”按钮 ...

  7. winform窗体最大化、最小化、还原

    //最大化 private void button_maxsize_Click(object sender, EventArgs e)        {            this.WindowS ...

  8. 部署node程序并维持正常运行时间

    12.2部署的基础知识 假定你创建了一个想要展示的Web程序,或者创建了一个商业应用,在把它放到生产环境中之前需要测试一下.你很可能会从一个简单的部署开始,然后再做些工作让它的正常运行时间和性能达到最 ...

  9. HTML基础--JS简介、基本语法、类型转换、变量、运算符、分支语句、循环语句、数组、函数、函数调用.avi

    JS简介 1.JavaScript是个什么东西? 它是个脚本语言,需要有宿主文件,它的宿主文件是HTML文件. 2.它与Java什么关系? 没有什么直接的联系,Java是Sun公司(已被Oracle收 ...

  10. mysql体系结构

    mysql逻辑架构: 第一层,即最上一层,所包含的服务并不是MySQL所独有的技术.它们都是服务于C/S程序或者是这些程序所需要的:连接处理,身份验证,安全性等等. 第二层值得关注.这是MySQL的核 ...