我想从 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和自定义字体,请给我一个例子或解决方案或示例代码谢谢你的帮助!