【问题标题】:Question about bounds/frame of custom class derived from UIView关于从 UIView 派生的自定义类的边界/框架的问题
【发布时间】:2011-06-09 00:11:33
【问题描述】:

我有一个派生自 UIView 的类,它表示将在其上绘制对象的正方形区域 (280x280),但不知何故只绘制了上部 (280x187)。

我检查了自定义视图类的initWithCoder和drawRect中的bounds和frame,结果是:

initWithCoder-->bounds:(280x280);帧:(280x280)

drawRect------->边界:(280x187);帧:(280x187)

在改变边界和框架的 initWithCoder 和 drawRect 方法之间可能发生什么?

感谢您的信息。

【问题讨论】:

    标签: ios uiview frame bounds


    【解决方案1】:

    在InterfaceBuilder中,我关闭了视图的自动调整大小并取出弹簧和支柱,然后视图正常显示。

    【讨论】:

    • 好的,值得一票。最后几个小时后,我被重新介绍给 autoresizeSubviews。
    猜你喜欢
    • 1970-01-01
    • 2010-11-10
    • 2013-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多