IOS - UILabel changes the appearance of a disabled label

In addition to my question yesterday, I use a view with UILabels that displays on an external monitor.

Labels can have text on them if they are not disabled. But the (obviously) disabled label has the text greyed out. Is there any way to reject this behavior?

The only thing I can think of is to subclass UILabel and have a variable setting it as editable, but will it affect serialization?

Thanks!

+6
source share
4 answers

Nevermind, it seems that the behavior cannot be changed. I just subclassed UILabel and added a variable to check if it can be edited. Greetings guys.

+1
source

If you want to prevent the user from interacting with the label, there is a property named userInteractionEnabled that you can set.

+3
source

Yes You can set the color and alpha attributes.

myLabel.textColor = [UIColor colorWithRed:0.3 green:0.6 blue:0.9 alpha:0.5] // set 'alpha' to something between 0-1 ------^^^ 
0
source

UILabel has the enabled property, you can set it to false to make it look like it is disabled.

For instance:

 let someLabel: UILabel() someLabel.enabled = false 

Hope this helps!

-1
source

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


All Articles