How to reference each UILabel in the application

I would like to change the font of each UILabel in each view of my application without encoding each of them (about 50). How can I do it?

In particular, I would like to know how to reference all UILabels .

thanks

+4
source share
1 answer

This can be easily handled by the new iOS 5 API. The 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; } 
+8
source

Source: https://habr.com/ru/post/1416622/


All Articles