修改UIWebView控件中字体的样式:
NSString *htmlString = [NSString stringWithContentsOfFile:self.webPath encoding:NSUTF8StringEncoding error:nil]; UIFont *font = [UIFont systemFontOfSize:12]; NSString *newHtmlString = [NSString stringWithFormat:@"<font face='%@' >%@", font.fontName,htmlString]; [self.myWebView loadHTMLString:newHtmlString baseURL:[NSURL URLWithString:self.webPath]];
其中self.webPath 为本地网页的路径。
修改UIWebView控件中字体的大小:
NSString *str = @"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '60%'";
[self.myWebView stringByEvaluatingJavaScriptFromString:str];
可以根据需要修改百分比。
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持靠谱客!
最后
以上就是友好乌龟最近收集整理的关于UIWebView控件中字体大小和字体样式的修改的全部内容,更多相关UIWebView控件中字体大小和字体样式内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复