I want to get the location of UILabel programatically. How can I do it, i.e. get the x and y of UILabel?
I tried textAlert.center.y
or textAlert.center.x
(textalert
is the name of UILabel).
A view that displays one or more lines of informational text.
To change the font or the size of a UILabel in a Storyboard or . XIB file, open it in the interface builder. Select the label and then open up the Attribute Inspector (CMD + Option + 5). Select the button on the font box and then you can change your text size or font.
It is the frame
property that you are looking for. Try that.
textAlert.frame.origin.x
textAlert.frame.origin.y
textAlert.frame.size.width
textAlert.frame.size.height
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