gpt4 book ai didi

iphone - 使用 webview 通过 safari 打开链接的问题

转载 作者:行者123 更新时间:2023-11-28 23:17:42 24 4
gpt4 key购买 nike

您好,我在通过 Safari 打开 Web 链接时遇到了问题。这是我的代码

标题

#import <UIKit/UIKit.h>


@interface qrcode_info : UIViewController <UIWebViewDelegate,UIAlertViewDelegate> {

}

@property (nonatomic, retain) IBOutlet UIWebView *Web;



@end



//main file


#import "qrcode_info.h"


@implementation qrcode_info
@synthesize Web;



-(BOOL)Web:(UIWebView *)Web shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
[[UIApplication sharedApplication] openURL:[request URL]];
return NO;
}

return YES;
}

//[[UIApplication sharedApplication] openURL:[inRequest URL]];
//return NO;


- (void)viewDidLoad {
[super viewDidLoad];
[Web loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"help" ofType:@"html"] isDirectory:NO]]];
//self.wvTutorial = [[WebViewController alloc] initWithNibName:@”WebView” bundle:[NSBundle mainBundle]];

}

最佳答案

-(BOOL)Web:(UIWebView *)Web shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

应该是

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

您不能更改委托(delegate)方法的签名并期望它被调用。

关于iphone - 使用 webview 通过 safari 打开链接的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5256937/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com