【问题标题】:UIAppearance for UILabel in UIActivityViewControllerUIActivityViewController 中 UILabel 的 UIAppearance
【发布时间】:2016-02-22 16:26:42
【问题描述】:

UILabels 出现在UIAlertControllers 中时,我有这段代码可以改变它们的外观:

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

但这也会影响出现在UIActivityViewControllers 中的UILabel。

如何排除 UIActivityViewController 中的 UILabel?

【问题讨论】:

    标签: ios uilabel uialertcontroller uiappearance


    【解决方案1】:

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

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

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

    【讨论】:

    • 这可能行得通 - 但我有一个相当大的应用程序,它非常广泛地使用 UIAlertController。
    • 它不会工作,因为情况与 UIActivityViewController 使用相同的界面相同
    • techlorr 我刚刚测试了使用子类的想法,它只会调整子类的字体。这意味着这将起作用。
    【解决方案2】:

    您可以使用objective c 的类冒充功能在UIAlertController 的出现次数中使用

    Class Posing

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-26
      • 2019-05-02
      • 1970-01-01
      • 2012-08-04
      • 2012-07-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多