UIWebView 自定义网页中的alert和confirm提示框风格
.h
#import <UIKit/UIKit.h>
@interface UIWebView (JavaScriptAlert)
-(void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
-(BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
@end
.m
#import "UIWebView+JavaScriptAlert.h"
@implementation UIWebView (JavaScriptAlert)
static BOOL diagStat = NO;
-(void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame{
UIAlertView* dialogue = [[UIAlertView alloc]initWithTitle:nil message:message delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil, nil];
[dialogue show];
[dialogue autorelease];
}
-(BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame{
UIAlertView* dialogue = [[UIAlertView alloc] initWithTitle:nil message:message delegate:self cancelButtonTitle:NSLocalizedString(@"Okay", @"Okay") otherButtonTitles:NSLocalizedString(@"Cancel", @"Cancel"), nil];
[dialogue show];
while (dialogue.hidden==NO && dialogue.superview!=nil) {
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01f]];
}
[dialogue release];
return diagStat;
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==0) {
diagStat=YES;
}else if(buttonIndex==1){
diagStat=NO;
}
}
@end
UIWebView 自定义网页中的alert和confirm提示框风格的更多相关文章
- Easyui中 messager.alert 后某文本框获得焦点
messager.alert 后某文本框获得焦点 $.messager.alert({ title:'消息', msg:'电话号码 只能是数字!', icon: 'info', width: 300, ...
- JavaScript中的alert、confirm、prompt
alert: var a=alert('Alert');//界面只有一個確定alert(a); //返回值為undefined confirm: var c= confirm('Confirm') ...
- android中常用的弹出提示框
转自:http://blog.csdn.net/centralperk/article/details/7493731 我们在平时做开发的时候,免不了会用到各种各样的对话框,相信有过其他平台开发经验的 ...
- easyui confirm提示框 调整显示位置
方法一: $.messager.confirm("确认对话框","该客户已经存在!确定:查看该客户 ", function(r){ if(r){ alert(& ...
- c#中的 MessageBox 弹出提示框的用法
MessageBox.Show(<字符串str> Text, <字符串str> Title, <整型int> nType,MessageBoxIcon); 例:Me ...
- [转]jQuery插件实现模拟alert和confirm
本文转自:http://www.jb51.net/article/54577.htm (function () { $.MsgBox = { Alert: function (title, msg) ...
- 模拟alert和confirm
啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了... 来看插件的实现代码吧: (function () { $ ...
- 自编jQuery插件实现模拟alert和confirm
现在绝大多数网站都不用自带的alert和confirm了,因为界面太生硬了.因此这个插件就这样产生了自己定制一个的想法...... 啥也不说,先上图,有图有真相 :) 现在绝大多数网站都不用自带的al ...
- jquery控件-实现自定义样式的弹出窗口和确认框(转)
(function () { $.MsgBox = { Alert: function (title, msg) { GenerateHtml("alert", title, ms ...
随机推荐
- php的ob_flush和flush(转)
php.ini中 output_buffering = off 关闭php的缓存 implicit_flush = Off php不会立即输出到浏览器.如果是ON,相当于每次ECHO 立刻执行一个FL ...
- GCC内嵌汇编
http://blog.csdn.net/mydo/article/details/8279924
- pcap 安装(debian7 linux) qt 使用pcap.h
安装方法一.sudo apt-get install libpcap-dev 安装方法二. 去http://www.tcpdump.org/下载最新的libpcap.tar.gz包 解压以后 ./co ...
- NDK开发之数组操作
JNI把Java数组当作引用类型来处理,JNI提供了必要的函数来访问和处理Java数组. 下面一个一个来看. 1.创建数组 我们可以使用NewArray函数在原生代码中创建数组实例,其中可以是Int. ...
- Plain old data structure(POD)
Plain old data structure, 缩写为POD, 是C++语言的标准中定义的一类数据结构,POD适用于需要明确的数据底层操作的系统中.POD通常被用在系统的边界处,即指不同系统之间只 ...
- C#开发的进化史
1.数据类型的进化 C#1中实现Product类型代码 public class Product { string name; public string Name { get { return na ...
- CSS排版页面
创建CSS文件如下: @charset "utf-8"; /* CSS Document */ *{ margin:0px; padding:0px; border:0px; } ...
- java 基本知识点学习
1 基本数据类型 整型4种:byte 1个字节:short 2个字节:int 4个字节:long 8个字节. 浮点型:float 4个字节;double 8个字节: 布尔型:boolean tru ...
- [Mime] MediaTypes--电子邮件类型类 (转载)
点击下载 MediaTypes.rar 这个类是关于 电子邮件类型类的操作,在发送电子邮件是规定以什么样的格式发送,Xml,HTML,文本等方式1.电子邮件类型帮助类,Xml格式,HTML格式等看下面 ...
- virtualbox共享文件夹无访问权限问题解决方法
virtualbox共享文件夹无访问权限问题解决方法 早就困扰了,这次新装虚拟机又碰到了,记录下来. 这篇文章主要介绍了virtualbox共享文件夹无访问权限问题解决方法,造成这个问题的原因是不跟v ...