How to force UILabel
to draw a text with upper case chars?
1 First, we use the prefix(1) method to get the first letter of the string. Then, we capitalized it. 2 We remove the first letter using dropFirst() to get the remaining letters. Then, we lowercased them with lowercased() .
A view that displays one or more lines of informational text.
Label is a user interface item in SwiftUI which enables you to display a combination of an image (icon, SF Symbol or other) and a text label in a single UI element.
Objective-C
NSString *text = @"Hello"; [myLabel setText:[text uppercaseString]];
Swift 3 & 4
let text = "Hello" myLabel.text = text.uppercased()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With