Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force UILabel to draw a text with upper case chars?

How to force UILabel to draw a text with upper case chars?

like image 465
Dmitry Avatar asked Sep 15 '13 21:09

Dmitry


People also ask

How do you make the first letter capital in Swift?

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() .

Is UILabel a view?

A view that displays one or more lines of informational text.

What is label Swift?

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.


1 Answers

Objective-C

NSString *text = @"Hello"; [myLabel setText:[text uppercaseString]]; 

Swift 3 & 4

let text = "Hello" myLabel.text = text.uppercased() 
like image 169
nevan king Avatar answered Oct 07 '22 00:10

nevan king