tags:

views:

848

answers:

4

Is there a way I can change the System FOnt for teh entire application?

I want to have it define for the entire APplication so that I dont have to go to individual label or individual fotn and change it.... I wnat a universal definition whcih will change all the fonts that exist within the applicaion

A: 

Fonts are specific to each control in the UI. For exmaple, each UILabel has its own font setting.

If you want to change the font of all controls, you'll have to change them all.

Ben S
+1  A: 

No - that's why it's called the system font, and not the application font.

Tim
Then is there somethign called as APplication font that I can use.... Coz i dotn wnat to individually assign font to every thing i have on the app... So is there a way i can define a font and then it will be used throught teh app
+3  A: 

Make a shared class called Constants.h or something. In it do this:

#define kStandardFont [UIFont systemFontOfSize:20]

Of course adjust the font to be what you need it to be. Then, whenever you need to use it (in a label or whatever) do this:

#import "Constants.h"
…
…
… 
[label setFont:kStandardFont];
coneybeare
+1  A: 

I think that the right answer is: Don't do that! Figure out why you think you want to do that, and then figure out some other way to achieve the same ends. And folks here would be happy to help figure out another way to those ends. (E.g. that's what coneybeare's answer effectively suggests.)

All that said...there's no way in the official SDK to change the system font. You might be able to make some headway by swizzling UIFont's systemFontWithSize: method -- see http://www.cocoadev.com/index.pl?MethodSwizzling for more on method swizzling. Bear in mind (a) this will only change the appearance of anything that uses systemFontWithSize: to get its font, (b) this might break all kinds of things that depend on the having the original font size, and (c) this might well get you rejected from the App Store.

All these caveats add up to the question: What are you really trying to accomplish with this?

Josh Bleecher Snyder