終於得到了我的問題的答案很長的研究
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[self stopProgressHUD];
NSString *cssString = [[[[@"body { font-family:" stringByAppendingString:centuryGothicRegular] stringByAppendingString:@"; font-size:"] stringByAppendingString:[NSString stringWithFormat:@"%ld",normalFont]] stringByAppendingString:@"}\""] ; //1
NSString *javascriptString = @"var style = document.createElement('style'); style.innerHTML = '%@'; document.head.appendChild(style)"; // 2
NSString *javascriptWithCSSString = [NSString stringWithFormat:javascriptString, cssString]; // 3
NSLog(@"javascriptWithCSSString: \n %@", javascriptWithCSSString);
NSString *loadedContent = [webView stringByEvaluatingJavaScriptFromString:javascriptWithCSSString];
NSLog(@"loaded ocntent: %@", loadedContent);
}
centuryGothicRegular是字體的哪個地方聲明爲常量名之後。 normalFont是也被聲明爲整數常量的字體大小