views:

194

answers:

2

Hello

I have a font in the resources and I loaded it into a UIFont

I want to know how to use this UIFont as the default font for my UIWebView

Thanks in advance...

+1  A: 

This might help you out:

http://stackoverflow.com/questions/449773/iphone-development-setting-uiwebview-font

Icky
Since he doesn't want to use a system-font but a UIFont-Class, I don't think it does. The way to go here might be a link to the font in the resource-folder, rather than using a UIFont, but I'm not really familiar with CSS.
Phlibbo
Hm sorry, I thought the question was directed towards how to use a specific font in a UIWebView - my bad, if I understood it incorrectly.
Icky
That is the correct way to do it. If you need to load a custom font, look up the CSS3 attribute of @font-face.
MishieMoo
+2  A: 

IF you are using webpage to display in the WebView Here is what I would do. 1. Create a string with the header of the HTML page add css file or embedded css in header 2. Create the body of HTML 3. Create ending elements of HTML

Append all the strings.

and load WebView from string

NSString *bundlepath = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:bundlepath]; [webView loadHTMLString:html baseURL:baseURL];

KiranThorat
Thank you, this helped a lot, but I was in a mess until I knew that Mobile Safari on iPhone/iPod Touch and iPad supports only SVG webfonts
Aubada Taljo