ios 中的半屏幕底部弹出框
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 中的半屏幕底部弹出框的更多相关文章
- JavaScript中的三种弹出框的区别与使用
JavaScript中有三种原生的弹出框,分别是alert.confirm.prompt.分别表示弹出框.确认框.信息框. 以下是示例代码: <!DOCTYPE html> <htm ...
- bootstrap中的modal 模态弹出框不能放在 form_for里面,一弹出modal会自动submit掉form
bootstrap中的modal 模态弹出框不能放在 form_for里面,一弹出modal会自动submit掉form
- 去掉网页中alert和confirm弹出框自带的网址
去掉网页中alert和confirm弹出框自带的网址 Alert: <script> window.alert = function(name){ var iframe = documen ...
- php中bootstrap框架.popover弹出框,鼠标移动到上面自动显示,离开自动消失
<div rel="name"></div> <script> $(function(){//显示弹出框 $("[rel=name]& ...
- 关于jsp和html页面中的三种弹出框
代码: <!-- 引入jquery 由于在下面使用jquery选择器,与弹出框无关 --> <script type="text/javascript" src= ...
- ASP.NET中的几种弹出框提示
B/S不像C/S那样一个MessageBox就可以弹出提示框,不过可以通过js的“Alert”来弹出消息,或者通过一些变种的js方法.下面我给大家介绍几种,希望大家喜欢. 四种弹出框代码: prote ...
- ASP.NET中的几种弹出框提示基本实现方法
我们在.NET程序的开发过程中,常常需要和用户进行信息交互,比如执行某项操作是否成功,“确定”还是“取消”,以及选择“确定”或“取消”后是否需要跳转到某个页面等,下面是本人对常用对话框使用的小结,希望 ...
- ASP.NET中的几种弹出框提示基本方法
NET程序的开发过程中,常常需要和用户进行信息交互,对话框的出现将解决了这些问题,下面是本人对常用对话框使用的小结,希望对大家有所帮助 我们在.NET程序的开发过程中,常常需要和用户进行信息交互,比如 ...
- 【分享】iOS功能界面漂亮的弹出框
STPopup 为 iPhone 和 iPad提供了 STPopupController UINavigationController 弹出的风格. 特性: Extend your view cont ...
随机推荐
- input file 模拟预览图片。
首先申明,接下来内容只是单纯的预览图片,最多选择九张,并没有和后台交互,交互的话需要自己另外写js. 本来想写一个调用摄像头的demo,意外的发现input file 在手机端打开的话,ios可以调用 ...
- php练习6——面向对象编程(打印乘法表)
要求:编写一个成员函数,从键盘输入一个数(0—9),打印出对应的乘法表 程序:viewChengFB.html chengFB.class.php printChengFB.php 结果
- nginx重新加载配置
1.kill -HUP `cat /usr/local/nginx/logs/nginx.pid` 2./usr/local/nginx/sbin/nginx -s reload
- PHP、JSP、.NET各自的真正优势是什么
PHP的优势在于, 跨平台, 极易部署, 易维护, 为Web而生, 开源社区强大, 文档丰富.至于说3足鼎立, 谈不上, 全球前100万的sites中, 70%是PHP. JSP和Asp..net 也 ...
- ssh登录docker容器
ssh登录docker容器1.启动一个docker容器# docker run -t -i ubuntu/ruby:v1 /bin/bash2.然后在容器里,安装openssh-server open ...
- xcode升级后, 插件失效修复
1. 首先查看 Xcode 的 UUID,在终端执行 defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilit ...
- combo下拉列表选择
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 教你在你的应用程序中扩展使用dynamic类型
教你在你的应用程序中扩展使用dynamic类型 相信大家在开发中经常会接触到mvc中的ViewBag,有心的同学会,发现这就是一个dynamic类型,查看源码一谈究竟,本文也是根据dynamic来扩展 ...
- java 堆与栈的区别
1. 堆与栈的区别? 1-1. 数据存放位置: 数据都存放于RAM (Random Access Memory). 1-2. 存放数据的类型:stack栈中保存方法中的基本数据类型(int, do ...
- Word文献类型标志
文献类型标识:专著:M:论文集:C:报纸文章:W:期刊文章:J:学位论文:D:研究报告:R:各种未定类型的文献:Z文献类型标识:专著:M:论文集:C:报纸文章:W:期刊文章:J:学位论文:D:研究报告 ...