problem with opening link through safari with webview

Posted by Desmond on Stack Overflow See other posts from Stack Overflow or by Desmond
Published on 2011-03-10T08:02:51Z Indexed on 2011/03/10 8:10 UTC
Read the original article Hit count: 257

Filed under:
|
|

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]];

}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode