Objective c 在webView中执行Segue时,应使用request和returning';否';
我有一个UIWebView,它加载带有html按钮的页面。当用户点击该按钮时,“http://somerequest“已加载 我在shouldStartLoadWithRequest(在下面的代码中)和when中捕获请求http://somerequest请求时,使用标识符“Comments”执行segue: “PerformsgueWithIdentifier”工作正常,但shouldStartLoadWithRequest函数未返回“否”。如果我删除“performsguewithidentifier”,函数将能够返回NO 请告诉我当UIWebView请求“http//somerequest”并且没有在当前UIWebView中加载请求(通过返回“否”)时,我如何执行segue 试试这个:Objective c 在webView中执行Segue时,应使用request和returning';否';,objective-c,ios,uiwebview,segue,Objective C,Ios,Uiwebview,Segue,我有一个UIWebView,它加载带有html按钮的页面。当用户点击该按钮时,“http://somerequest“已加载 我在shouldStartLoadWithRequest(在下面的代码中)和when中捕获请求http://somerequest请求时,使用标识符“Comments”执行segue: “PerformsgueWithIdentifier”工作正常,但shouldStartLoadWithRequest函数未返回“否”。如果我删除“performsguewithident
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
BOOL returnValue = YES;
if([[url absoluteString] isEqualToString:@"http://somerequest"])
{
[self performSegueWithIdentifier:@"Comments" sender:self];
returnValue = NO;
}
return returnValue;
}
以任何方式设置断点以确保“returnValue=NO;”被称为。
沙尼不工作。无论何时调用[self-PerformsgueWithIdentifier:@“Comments”sender:self],函数都返回YES;您是否设置了断点以确保“返回是;”您的回答是正确的,这实际上是我遇到的与jQuery移动相关的问题。
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
BOOL returnValue = YES;
if([[url absoluteString] isEqualToString:@"http://somerequest"])
{
[self performSegueWithIdentifier:@"Comments" sender:self];
returnValue = NO;
}
return returnValue;
}