UIAppearance for UILabel in UIActivityViewController

I have this code that changes the appearance of UILabel when they appear in UIAlertController s:

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

But it also affects the UILabels that appear in UIActivityViewController s.

enter image description here

How can I exclude UILabels in a UIActivityViewController ?

+5
source share
2 answers

Instead of trying to set / disable the appearance depending on your situation, you can subclass your own UIAlertController and use

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

then when the action sheet opens, it will not be your subclass, so the rule will not apply.

+5
source

You can use the positioning function of class objective c to be used in all cases by the UIAlertController

Class Posing

0
source

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


All Articles