Reputation: 27114
I have a debugger in this loop :
for view: UIView in containerView.subviews {
// debugger stops here!
var rect = CGRectMake(0,contentRect.size.height, self.view.frame.width, view.frame.height)
contentRect = CGRectUnion(contentRect, rect)
}
If I run :
(lldb) po view
<UILabel: 0x7ff45176f800; frame = (0 0; 11516.5 20.5); text = 'Many translations suggest...'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x7ff45176fa10>>
I naturally assume that I could access the text
attribute via :
po view.text
But that returns :
error: <EXPR>:1:1: error: value of type 'UIView' has no member 'text'
How can I access this attribute?
Upvotes: 0
Views: 110
Reputation: 130072
The same way you would access it in code, you have to cast it, otherwise the debugger still sees view
as a UIView
instance:
// Swift
po (view as! UILabel).text
// Obj-C
po [(UILabel *) view text]
Upvotes: 6