static UIView *modalView;
if (modalView) {
[modalView removeFromSuperview];
modalView = nil;
return;
} CGRect screen = [[UIScreen mainScreen] bounds];
CGRect bounds = CGRectMake(screen.origin.x, screen.origin.y, screen.size.width, screen.size.height/);
modalView = [[UIView alloc] initWithFrame:bounds];
modalView.opaque = NO;
modalView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f]; UILabel *label = [[UILabel alloc] init];
label.text = @"Modal View";
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor clearColor];
label.opaque = NO;
[label sizeToFit];
[label setCenter:CGPointMake(modalView.frame.size.width / , modalView.frame.size.height / )];
[modalView addSubview:label]; [self.view addSubview:modalView];

若要从xib众加载UI的外观,则:

if (popupViewController) {
[popupViewController.view removeFromSuperview];
popupViewController = nil;
return;
} popupViewController = [[UIViewController alloc] initWithNibName:@"View" bundle:nil];
[self.view addSubview:popupViewController.view];

如果需要从底部的动画向上slide in的动画:

UIView *popView = popupViewController.view;
CGRect orig = popView.bounds;
CGRect screen = [[UIScreen mainScreen] bounds];
[popView setFrame:CGRectMake(, screen.size.height, orig.size.width, orig.size.height)];
[UIView beginAnimations:@"animatePopView" context:nil];
[UIView setAnimationDuration:0.4];
[popView setFrame:CGRectMake(, screen.size.height-orig.size.height, orig.size.width, orig.size.height)];
[UIView commitAnimations];

Add a UIView above all, even the navigation bar

UIView* myView = /* Your custom view */;
UIWindow* currentWindow = [UIApplication sharedApplication].keyWindow;
[currentWindow addSubview:myView];

或者:

[self.navigationController.view addSubview:overlayView];

ios 中的半屏幕底部弹出框的更多相关文章

  1. JavaScript中的三种弹出框的区别与使用

    JavaScript中有三种原生的弹出框,分别是alert.confirm.prompt.分别表示弹出框.确认框.信息框. 以下是示例代码: <!DOCTYPE html> <htm ...

  2. bootstrap中的modal 模态弹出框不能放在 form_for里面,一弹出modal会自动submit掉form

    bootstrap中的modal 模态弹出框不能放在 form_for里面,一弹出modal会自动submit掉form

  3. 去掉网页中alert和confirm弹出框自带的网址

    去掉网页中alert和confirm弹出框自带的网址 Alert: <script> window.alert = function(name){ var iframe = documen ...

  4. php中bootstrap框架.popover弹出框,鼠标移动到上面自动显示,离开自动消失

    <div rel="name"></div> <script> $(function(){//显示弹出框 $("[rel=name]& ...

  5. 关于jsp和html页面中的三种弹出框

    代码: <!-- 引入jquery 由于在下面使用jquery选择器,与弹出框无关 --> <script type="text/javascript" src= ...

  6. ASP.NET中的几种弹出框提示

    B/S不像C/S那样一个MessageBox就可以弹出提示框,不过可以通过js的“Alert”来弹出消息,或者通过一些变种的js方法.下面我给大家介绍几种,希望大家喜欢. 四种弹出框代码: prote ...

  7. ASP.NET中的几种弹出框提示基本实现方法

    我们在.NET程序的开发过程中,常常需要和用户进行信息交互,比如执行某项操作是否成功,“确定”还是“取消”,以及选择“确定”或“取消”后是否需要跳转到某个页面等,下面是本人对常用对话框使用的小结,希望 ...

  8. ASP.NET中的几种弹出框提示基本方法

    NET程序的开发过程中,常常需要和用户进行信息交互,对话框的出现将解决了这些问题,下面是本人对常用对话框使用的小结,希望对大家有所帮助 我们在.NET程序的开发过程中,常常需要和用户进行信息交互,比如 ...

  9. 【分享】iOS功能界面漂亮的弹出框

    STPopup 为 iPhone 和 iPad提供了 STPopupController UINavigationController 弹出的风格. 特性: Extend your view cont ...

随机推荐

  1. linux驱动(一)

    编写模块必须先声明下面两句: #include <linux/module.h>               //这个头文件包含了许多符号与函数的定义,这些符号与函数多与加载模块有关 #i ...

  2. Linux 进程编程

    Linux通过维护者五个状态来调度进程的运行.这五个状态分别为:运行.可中断.不可中断.僵死.停止 . PID来标识不同的进程的,Linux中每一个进程都有一个唯一的进程号 . PCB块就是一个进程资 ...

  3. Windows7 下安装 CentOS6.5

    内容来自:http://blog.163.com/for_log/blog/static/2162830282013031031278/第一部分:安装前准备1. 准备两个fat32格式的分区,一个用于 ...

  4. mvc中的OutputCache

    mvc4中有一个标记属性OutputCache,用来对ActionResult结果进行缓存,如何理解呢?概括地说,就是当你的请求参数没有发生变化时,直接从缓存中取结果,不会再走服务端的Action代码 ...

  5. Yii 权限分级式访问控制实现(非RBAC法)

    以下由我们在信易网络公司开发项目的时候终结出的一些经验 主要参考资料:yii官网http://www.yiiframework.com/wiki/60/yii framework 提供了2套权限访问系 ...

  6. 表格td、th强制换行

    表格td.th强制换行 <table style="table-layout:fixed" width="100%"> <tr>< ...

  7. 阿里云主机建立SWAP分区脚本

    工具:add_swap.sh    所有执行的脚本都需要root身份来执行,执行方法:以root身执行命令:bash xxx.sh 功能:自动检测系统swap分区大小,交换分区大小不合理则自动新增并挂 ...

  8. list和数组之间相互的转化

    list变成数组: String[] str=(String[]) list.toArray(new String[list.size()]); 数组变成list: List<String> ...

  9. 无法修改系统Host的解决办法

    有些时候可能因为杀毒软件的问题,即使打开隐藏文件也是无法正常看到hosts的. 此时可以新建一个hosts文件去覆盖目录下的文件即可见 路径:C:\Windows\System32\drivers\e ...

  10. 数据采集服务提供商,ip提供商 里面有些不错的基础数据

    http://user.qzone.qq.com/1649677458 这家公司的爬虫应该挺牛的 !@#!#!~#¥¥¥@@http://www.site-digger.com/