我想从html代码中显示一个视图 这是我从Web视图添加到主视图的代码,
- (void) createWebViewWithHTML{
//create the string
NSMutableString *html = [NSMutableString stringWithString: @"<html><head><title></title></head><body style=\"background:transparent;\">"];
//continue building the string
[html appendString:@"body content here"];
[html appendString:@"</body></html>"];
//instantiate the web view
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame];
//make the background transparent
[webView setBackgroundColor:[UIColor clearColor]];
//pass the string to the webview
[webView loadHTMLString:[html description] baseURL:nil];
//add it to the subview
[self.view addSubview:webView];
} 但问题是: 1,uiwebview的背景是白色不透明 2,我想在我的代码中添加css和自定义字体,请给我一个示例或解决方案或示例代码 谢谢你的帮助!
答案 0 :(得分:0)