gpt4 book ai didi

iphone - 如何在应用程序中引用每个 UILabel

转载 作者:可可西里 更新时间:2023-11-01 05:14:51 24 4
gpt4 key购买 nike

我想在我的应用程序的每个 View 中更改每个 UILabel 的字体,而不用对每个 View (大约 50 个)进行编码。我该怎么做呢?

具体来说,我想知道如何引用所有 UILabels

谢谢

最佳答案

这可以通过新的 iOS 5 外观 API 轻松处理。外观 API 允许您更改整个应用程序中控件的外观。

看看我下面的截图: http://www.youtube.com/watch?v=L63CU2T7DBE&list=UUKvDySsrOVgUgRLhWHeyHJA&index=4&feature=plcp

这可能有效:

- (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;
}

关于iphone - 如何在应用程序中引用每个 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10935329/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com