【问题标题】:How does a subview frame change if I transform the view frame?如果我转换视图框架,子视图框架如何变化?
【发布时间】:2010-09-25 17:42:50
【问题描述】:

我必须这样做:

1:CGRect originalSubviewFrame = subview.frame;
2:view.frame = (CGRect)newFrame;
3:subview.frame = originalSubviewFrame;

我认为指令 1 和 3 不应该存在,但如果我不恢复子视图形状,它会因某种原因而改变!?!? 我阅读了文档,但不清楚。

【问题讨论】:

    标签: iphone objective-c uiview uiscrollview ios


    【解决方案1】:

    如果subviewview 的子视图,那么当view 的帧发生变化时,它的帧是否发生变化取决于view.autoresizesSubviews 是否为YES,如果是,则其表现方式由subview.autoresizingMask 确定.

    我鼓励您阅读有关这两个属性的UIView documentation

    【讨论】:

    • 正确!此类动画的最佳答案。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多