iPhone — is it possible to inspect the frame of a UIView in the Xcode debugger?

前端 未结 12 573
执念已碎
执念已碎 2021-02-02 08:18

When the debugger is stopped at a breakpoint, I can\'t find the frame of any of my UIViews in there.

Is it possible to do this?

EDIT: starting a bounty due to th

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-02 08:36

    Interestingly, using the getter method to return the view's frame works:

    print (CGRect)[view frame]
    

    This gives the expected result:

    (CGRect) $2 = origin=(x=0, y=20) size=(width=320, height=48)
    

    But if you try to use dot notation, which I hear so often referred to as being provided simply for 'syntactic sugar':

    print (CGRect)view.frame
    

    You get the following error:

    error: C-style cast from '' to 'CGRect' is not allowed
    

提交回复
热议问题