How to show text in UILabel as secured in iphone

I am using UILabel

to display the value of the year which I select through UIPickerView

. I want the field of the year to be safe. In UITextfield

we will be using setSecureTextEntry

, do we have anything similar for UILabel

?

thank

+3


source to share


2 answers


Why don't you just display your UILabel with * ? I don't understand why you need to make the shortcut "safe" when you control what is displayed.



+4


source


I'm not sure if I really understand your question, but assuming you want to display asterisks instead of text in the label, just enter the length of the string you normally show and replace the characters with asterisks:



NSString *myPickerValue = @"MyPickerValue";
self.myLabel.text = [@"" stringByPaddingToLength: [myPickerValue length] withString: @"*" startingAtIndex:0];

      

+3


source







All Articles