得到UILabel的x和y的值?

Tus*_*ani 6 cocoa-touch objective-c ios4

我想以编程方式获取UILabel的位置.我怎么能这样做,即得到UILabel的x和y?

我试过textAlert.center.ytextAlert.center.x(textalert是UILabel的名字).

Dee*_*olu 10

这是frame您正在寻找的财产.试试吧.

textAlert.frame.origin.x
textAlert.frame.origin.y
textAlert.frame.size.width
textAlert.frame.size.height
Run Code Online (Sandbox Code Playgroud)