problem with opening link through safari with webview
- by Desmond
hi i had encounter a problem opening a web link through safari. this is my code
header
#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]];
}