错误:在'UIView *'类型的对象上找不到属性'frame' [英] error: property 'frame' not found on object of type 'UIView *'

查看:579
本文介绍了错误:在'UIView *'类型的对象上找不到属性'frame'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试我的代码并尝试使用以下方法计算视图的大小:

I'm debugging my code and trying to figure out the size of the view using this:

p view.frame.size.height

但我收到此错误:

错误:在'UIView *'类型的对象上找不到属性'frame'
错误:1解析表达式时出错

error: property 'frame' not found on object of type 'UIView *' error: 1 errors parsing expression

你们中的任何人我知道为什么或如何调试我的视图大小?

any of you knows why or how can I debug the size of my view?

推荐答案

如果你每次都讨厌类型转换,你可以试试这个:

If you hate typecasting every time, you can try this:

(lldb) expr @import UIKit
(lldb) po self.view.bounds

由于Xcode 7.2现已推出,我认为我们应该更新答案。

我在这里找到答案,为什么LLDB无法打印view.bounds?

Since Xcode 7.2 is now available, I think we should update the answer.
I find the answer here, Why can't LLDB print view.bounds?

这篇关于错误:在'UIView *'类型的对象上找不到属性'frame'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆