アプリで生成しているHTMLがあります。W3Schoolsで「編集して試してみてください」と実行したので、有効であることがわかります。設計どおりに動作します。
ヘッダーファイルでのWebサイトの定義は次のとおりです。
@interface ReportViewController : UIViewController <UIWebViewDelegate> {
IBOutlet UIWebView *reportWebView;
}
@property (nonatomic, retain) UIWebView *reportWebView;
@property (nonatomic, retain) NSMutableString *html;
- (void) generateReport;
- (void) Alert: (NSString *) title andData: (NSString *) errorMsg;
@end
ここで、HTMLの作成を終了し、表示してみます。
// now do the table
[html appendString:@"<div><table border class=\"boldtable\">"
"<tr BGCOLOR=\"ADDAFE\">"
"<th>STA </th><th>BS </th><th>HI </th><th>FS </th><th>ELEV </th><th>Desc</th>"
"</tr><p>"];
}
// finally, end the table, etc.
[html appendString:@"</table></div></body></html>"];
// UIWebView *reportWebView = [[UIWebView alloc] init];
//[reportWebView loadHTMLString: html baseURL:nil];
[self.reportWebView loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
}
ご覧のとおり、HTML文字列を表示するさまざまなバリエーションを試しました。これを行う正しい方法は何ですか?