在Safari中打开URL而不是webView



我有一个应用程序,在表视图中填充RSS提要。在表中选择一行,打开一个包含整篇文章的新视图。我的问题是有时RSS提要中有超链接。单击链接将打开同一视图中的内容,而不是safari。我想打开任何链接,在RSS提要在safari关于离开应用程序的警告消息。但我不知道如何处理这个在我的代码。任何线索都会有帮助的。我粘贴我的代码DetailedView下面。

    - (void)viewDidLoad {
[self.itemSummary loadHTMLString:[item objectForKey:@"summary"] baseURL:nil];
}

 - (id)initWithItem:(NSString *)theItem {
    if (self = [super initWithNibName:@"Detail" bundle:nil]) {  
        self.item = theItem;  
        self.title = [item objectForKey:@"title"];
    }  
    return self;  
}  

试试下面的代码:

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
    if ( inType == UIWebViewNavigationTypeLinkClicked ) {
        [[UIApplication sharedApplication] openURL:[inRequest URL]];
        return NO;
    }
    return YES;
}

最新更新