iphone--js与oc通信记录几个实用方法

@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 {
    
    NSLog(@"javascript alert : %@",message);
    
    UIAlertView* customAlert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    
    [customAlert show];
    
    [customAlert autorelease];
    
}
@end

修改由js弹出出的提示框UIAlertView样式

默认是标题为网址,确定键为“好”,可以用以上方法修改默认值


你可能感兴趣的:(JavaScript,interface)