Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get the value of x and y of UILabel?

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

like image 972
Tushar Chutani Avatar asked May 21 '11 23:05

Tushar Chutani


People also ask

What is UILabel?

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

How do I change my UILabel?

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.


1 Answers

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
like image 153
Deepak Danduprolu Avatar answered Sep 22 '22 15:09

Deepak Danduprolu