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. 【PHP】解决html网页乱码问题

    在自己制作一个网页时,时常会遇到网页乱码的问题. 其实导致网页乱码主要有几个原因,以下给出解决方法. 1.HTML的字符编码问题 该问题较常见,也是最明显和最容易解决的. 在网页<head> ...

  2. SQLServer:定时作业

    SQLServer:定时作业: 如果在SQL Server 里需要定时或者每隔一段时间执行某个存储过程或3200字符以内的SQL语句时,可以用管理-SQL Server代理-作业来实现 也快可以定时备 ...

  3. Map集合的四种遍历

    Map集合遍历 Map<String,Integer> m = new HashMap<String,Integer>(); m.put("one",100 ...

  4. 教你在你的应用程序中扩展使用dynamic类型

    教你在你的应用程序中扩展使用dynamic类型 相信大家在开发中经常会接触到mvc中的ViewBag,有心的同学会,发现这就是一个dynamic类型,查看源码一谈究竟,本文也是根据dynamic来扩展 ...

  5. bzoj 1576: [Usaco2009 Jan]安全路经Travel 树链剖分

    1576: [Usaco2009 Jan]安全路经Travel Time Limit: 10 Sec  Memory Limit: 64 MB Submit: 665  Solved: 227[Sub ...

  6. Hdu 2971 Tower

    Description Alan loves to construct the towers of building bricks. His towers consist of many cuboid ...

  7. SQL Server 2005 版本的操作系统兼容性详细列表

    操作系统要求(32 位) 此表显示对于每种 32 位版本的 SQL Server 2005,操作系统是否可以运行其服务器软件. 有关如何在 Windows Server 2008 上安装 SQL Se ...

  8. 【简译】JavaScript闭包导致的闭合变量问题以及解决方法

    本文是翻译此文 预先阅读此文:闭合循环变量时被认为有害的(closing over the loop variable considered harmful) JavaScript也有同样的问题.考虑 ...

  9. Android 使用LinearLayout.getChildAt(i)获取一个线性布局的view,并实现content中实现方法

    1.定义接口content的方法,如ok,cancle; 2.在View的处理类myview中实现content的方法. 3.通过contently.getChildAt(i)的方法获得View v; ...

  10. 转:二十一、详细解析Java中抽象类和接口的区别

    转:二十一.详细解析Java中抽象类和接口的区别 http://blog.csdn.net/liujun13579/article/details/7737670 在Java语言中, abstract ...