iOS UIWebview 分类 实现修改 javascript 两种提示框
来源:互联网 发布:java经典算法100例 编辑:程序博客网 时间:2024/05/05 16:21
@interface UIWebView (JavaScriptAlert)
- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect *)frame;
-(BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect *)frame;
@end
#import "UIWebView.h"
@implementation UIWebView (JavaScriptAlert)
- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect *)frame {
UIAlertView* customAlert = [[UIAlertView alloc] initWithTitle:@"提示信息" message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
[customAlert show];
//[customAlert autorelease];
}
static BOOL diagStat = NO;
static NSInteger bIdx = -1;
- (BOOL)webView:(UIWebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect *)frame {
UIAlertView *confirmDiag = [[UIAlertView alloc] initWithTitle:@"提示"
message:message
delegate:self
cancelButtonTitle:@"取消"
otherButtonTitles:@"确定",nil];
[confirmDiag show];
bIdx = -1;
while (bIdx==-1) {
//[NSThread sleepForTimeInterval:0.2];
[[NSRunLoop mainRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1f]];
}
if (bIdx == 0){//取消;
diagStat = NO;
}
else if (bIdx == 1) {//确定;
diagStat = YES;
}
return diagStat;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
bIdx = buttonIndex;
}
@end
- iOS UIWebview 分类 实现修改 javascript 两种提示框
- iOS UIWebView 修改userAgent
- IOS UIWebView 中使用JavaScript 来实现图片大小自适应
- iOS UIWebView 与 JavaScript 交互 代码实现 嵌入 js 脚本
- IOS UIWebView 中使用JavaScript 来实现图片大小自适应
- IOS UIWebView与JavaScript交互实现Web App
- iOS UIWebview添加请求头的两种方式
- iOS UIWebView 修改user-agent
- iOS UIWebView 修改user-agent
- iOS UIWebView 修改user-agent
- iOS修改UIWebView中的图片大小
- iOS UIWebView 修改user-agent
- iOS UIWebView 修改user-agent
- iOS UIWebView 修改user-agent
- iOS 修改UIWebView的UserAgent
- iOS - UIWebView和JavaScript互调
- iOS UIWebView与JavaScript交互
- iOS UIWebView与JavaScript交互
- iPhone开发 – iPhonAn App ID with Identifier 'XX.XX' is not available. Please enter a different string
- Hello World~~
- 通过DG来升级duplicate方法不合适
- JAVA虚拟机内置锁机制的升级流程
- Android之继承Textview的EditText,CheckedTextView的介绍
- iOS UIWebview 分类 实现修改 javascript 两种提示框
- IOS策略模式与多态
- Android图片大小处理
- Cookies 和 Session的区别
- Opendap 4:Hyrax配置BES netcdf handler
- Volley请求
- php 代码片段
- linux不能ping通域名能ping通ip
- OJ解题报告 4976:硬币