How to reference every UILabel in an application

ios, iphone, objective-c

Solution

This can easily be handled by the new iOS 5 appearance API. Appearance API allows you to change the appearance of the control throughout the application.

Take a look at my screenshot below: http://www.youtube.com/watch?v=L63CU2T7DBE&list=UUKvDySsrOVgUgRLhWHeyHJA&index=4&feature=plcp

This might work:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UILabel appearance] setFont:[UIFont fontWithName:@"Marker Felt" size:56]];

    [[UILabel appearanceWhenContainedIn:[UIButton class], nil] setFont:[UIFont fontWithName:@"Marker Felt" size:10]];

    [[UINavigationBar appearance] setTintColor:[UIColor blueColor]];

    return YES;
}

Problem

I'd like to change the font of every `UILabel` in every view of my application without coding every single one (about 50). How would i go about doing this? Specifically, i'd like to know how to reference all `UILabels`. Thanks

Original source