我用這個也:如何處理警報點擊從UIWebview產生的警報。
@interface UIWebView (JavaScriptAlert)
- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
@end
@implementation UIWebView (JavaScriptAlert)
- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
UIAlertView *dialogue = [[UIAlertView alloc] initWithTitle:@"My Alert Title" message:message delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[dialogue show];
}
能否請您對一個UIWebView –
創建類別共享代碼在這個類別看看https://github.com/wangruofeng/IOS-Categories/blob /master/IOS-Categories/UIKit/UIWebView/UIWebView%2BAlert.m –