我有两个带有UIWebViews场景的视图控制器。主要的一个名为MainViewController,应该调用第二个名为ViewController,当用户在其中添加PostPicPopUp链接时调出该场景。 在MainViewController中我有:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *urL=request.URL;
NSString *urlStr=[urL absoluteString];
//NSLog(@"URLL %@",urlStr);
if ([urlStr rangeOfString:@"PostPicPopUp"].location == NSNotFound) {
return YES;
} else {
return NO;
}
}
所以我需要之前的代码
return YES
答案 0 :(得分:0)
您可以使用下面的代码手动调用您的视图控制器:
// Objective-C
ViewController *controller = [[ViewController alloc] init];
[self controller animated:YES completion:nil];
// Using storyboard
ViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MyViewControllerIdentifier"];
[self presentViewController:controller animated:YES completion:nil];