I'm trying to change Font in UIWebView.
I tried with the following codes to change Font.
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *cssPath = [path stringByAppendingPathComponent:@"test.css"];
if(!cssPath)
{
NSLog(@"NO");
}
NSString *js = [NSString stringWithFormat:@"var cssChild = document.createElement('link');"
"cssChild = 'text/css';"
"cssChild = 'stylesheet';"
"cssChild = '%@';", cssPath];
js = [NSString stringWithFormat:@"%@ document.getElementsByTagName('head')[0].appendChild(cssChild);", js];
[webViewOfInitial stringByEvaluatingJavaScriptFromString:js];
I append css file into header of loaded page from internet. my css file is following like that.
@font-face {
font-family: 'Zawgyi-One';
font-style: normal;
src: local('Zawgyi-One');
}
body {
font-family: 'Zawgyi-One';
}
However when i retrieve html tags when finished page loaded , i can't find my above css tags.
So how do i append that css file into current page of UIWebView's header tags?
Or is there any others tutorials for UIWebView Font change?
Thanks.