我想将rtf加载到具有清晰背景的Web视图中。关于创建具有明确背景的UIView的一般共识需要添加html代码来设置背景颜色:透明像这样......
myWebView.backgroundColor = [UIColor clearColor];
mytWebView.opaque = NO;
[yWebView loadHTMLString:@"<html><head><style>body{background-color:transparent;}</style> </head><body>your content here!</body></html>" baseURL:nil];
如何格式化HTML字符串以包含rtf。
谢谢,
约翰
答案 0 :(得分:1)
您可以使用保存RTF内容的stringWithFormat method. Assuming a string called
rtf`在NSString中加载html,只需使用以下行:
[yWebView loadHTMLString:[NSString stringWithFormat:@"<html><head><style>body{background-color:transparent;}</style> </head><body> %@ </body></html>", rtf] baseURL:nil];
请注意您的RTF所在的%@
和嵌套的stringWithFormat:
电话。