設定に InAppSettingsKit を使用しており、テーブル ビューのフッターに会社のハイパーリンクを追加したいと考えています。セクション ヘッダー (テーブル ビューの下部にあり、フッターとして表示されます) に uiwebview を正常に追加しました。Web ビューにはハイパーリンクが表示されますが、タッチに反応しません。
Web ビューは、settingsViewController:tableView:viewForHeaderForSection で作成されます。
UIView *containerView = [[UIView alloc] init];
containerView.backgroundColor = [UIColor clearColor];
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(30, 0, self.view.frame.size.width-60, 35)];
webView.delegate = self;
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSYearCalendarUnit fromDate:[NSDate date]];
NSUInteger fontSize = 13;
NSString *link = @"<a href=\"http://www.google.com\">My Hyperlink</a>";
[webView loadHTMLString:[NSString stringWithFormat:@"<html><head></head><body style=\"font-family: sans-serif;font-size:%dpx;\"> <center>Copyright © %d %@</center></body></html>", fontSize, dateComponents.year,link] baseURL:nil];
webView.backgroundColor = [UIColor clearColor];
webView.opaque = NO;
[containerView addSubview:webView];
return containerView;
および uiwebview デリゲート メソッド:
-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
DDLogVerbose(@"Web view should start load with request %@. InType: %d", inRequest.URL.absoluteString, inType);
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}
return YES;
}
タッチが機能しない理由を誰か教えてもらえますか?? ところで... webView:shoudStartLoadWithRequest: テーブルビューがロード/表示されるとすぐに呼び出されます
どうも!