【发布时间】:2012-09-13 13:58:22
【问题描述】:
我有一个加载带有 html 按钮的页面的 UIWebView。当用户点击该按钮时,会加载“http://somerequest”。
我在 shouldStartLoadWithRequest 中捕获请求(在下面的代码中),当请求“http://somerequest”时,使用标识符“Comments”执行 segue:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
if([[url absoluteString] isEqualToString:@"http://somerequest"])
{
[self performSegueWithIdentifier:@"Comments" sender:self];
return NO;
}
return YES;
}
“performSegueWithIdentifier”工作正常,但 shouldStartLoadWithRequest 函数未返回“NO”。如果我删除“performSegueWithIdentifier”,该函数能够返回 NO。
请告诉我当 UIWebView 请求“http//somerequest”并且未在当前 UIWebView 中加载请求(通过返回“NO”)时如何执行 segue。
【问题讨论】:
标签: objective-c ios uiwebview segue