UIActivityViewController中UILabel的UIAppearance

5

我有一段代码,当 UILabel 出现在 UIAlertController 中时,可以改变它们的外观:

UILabel *appearanceLabel = [UILabel appearanceWhenContainedInInstancesOfClasses:@[[UIAlertController class]]];
    [appearanceLabel setAppearanceFont:kFontRegular(18)];

但是这也会影响到出现在UIActivityViewController中的UILabels。

enter image description here

如何在UIActivityViewController中排除UILabels?

2个回答

6

不要试图根据情况设置/取消外观,您可以尝试子类化自己的UIAlertController并使用

UILabel *appearanceLabel = [UILabel appearanceWhenContainedInInstancesOfClasses:@[[MyAlertController class]]];
    [appearanceLabel setAppearanceFont:kFontRegular(18)];

当操作表打开时,它不会是您的子类,因此规则将不适用。

这可能会起作用 - 但我有一个使用UIAlertController相当广泛的大型应用程序。 - Halpo
无法正常工作,因为UIActivityViewController仍在使用相同的接口。 - techloverr
我刚刚测试了使用子类的想法,它只会调整子类的字体。这意味着这将起作用。 - Steve

-1
你可以使用 Objective C 的类欺骗特性来在许多出现的 UIAlertController 中使用它。

类欺骗


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接