我正在使用 WebView ,它工作正常。但我遇到了三个问题 1.我想更改字体 2.更改字体大小 3.当我将网页内容滚动到底部时,它不会向上滚动到底部。
content=[[UIWebView alloc]init];
content.Frame=CGRectMake(10, 200, 300, 480);
[content loadHTMLString:content1 baseURL:nil];
[content loadHTMLString:[NSString stringWithFormat:@"<html><body background-colo r: transparent text=\"#eadfa8\" font-family=\"Arial Rounded MT Bold\" font-size=\".1\">%@</body></html>", [self.JSONData objectForKey:@"content"]] baseURL: nil];
[content stringByEvaluatingJavaScriptFromString: @"content.body.style.fontFamily = 'Arial'"];
content.opaque=YES;
[self.view addSubview:content];
[content setBackgroundColor:[UIColor clearColor]];
[content setOpaque:NO];
以上 html 编码我尝试将字体系列更改为 Arial 但它不起作用。帮我 。
最佳答案
前两个问题的答案是 Font change inside UIWebView
您可以通过以下几行克服的第三个问题
content.scalesPageToFit=TRUE;
content.scrollView.bounces = NO;
关于ios - 在底部滚动不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23332487/