关于webapp的一个webframe问题

时间:2023-12-15 17:36:56

最近重启ios webapp的项目,将之前的框架拿过来发现出现了错误,错误出现在写JSAlart控件的WebFrame上,xcode会报WebFrame是未定义的错误。由于之前使用的是ios5的 sdk现在是ios7的SDK,不知道是不是做了修改 了,现在只需要将WebFrame改成CGRect就可以了。附上代码修改:

原代码:

@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* customAlert = [[UIAlertView alloc] initWithTitle:@"消息提示" message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

[customAlert show];   [customAlert autorelease];      }

@end

改成:(注意红色的部分)

@interface UIWebView (JavaScriptAlert)

- (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(CGRect*)frame;

@end

@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];

}

@end