amok
amok

Reputation: 1745

Xcode debugger, I don't get this

I am trying to understand how to accomplish some basic debugging stuff with gdb

I want to check the length of this control (UILabel) if I type the following in the console I get nothing, what's the proper way to do it?

(gdb) po self.mylabel.frame.size.width
There is no member named frame.

or if I try without self:

(gdb) po mylabel.frame.size.width
There is no member named frame.

There must be a way, not obvious for sure. Visual Studio has such a fantastic debugger helpers in tracking the values of objects and co...

Upvotes: 4

Views: 1764

Answers (1)

Kris Markel
Kris Markel

Reputation: 12112

If you just type po myLabel, it will output the frame details. Of you can also use po NSStringFromCGRect(myLabel.frame). (See this link for some useful function along the lines of NSStringFromCGRect.)

Alternatively, width is a float, so you can use p (float) myLabel.frame.size.width.

In general, po is used to print the value of objects, while p is used for basic types.

Upvotes: 2

Related Questions