V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
tsinghan
V2EX  ›  iOS

ios 父 view 进行了 rotation 同时修改了 frame 子 view 会随着变化吗?

  •  
  •   tsinghan · 2015-04-14 22:04:38 +08:00 · 2468 次点击
    这是一个创建于 3291 天前的主题,其中的信息可能已经有所发展或是发生改变。

    现在的情景如下
    view1 是父 view2 是子view
    view2是通过约束来确定在父view中的位置的

    我现在对父view进行了CGAffineTransformMakeRotation, 而且在animation 修改了父view的frame, 我写了个demo测试了一下, 当对父view进行上面操作时, 子view的约束,不会随着适应, 是我哪里疏忽了, 还是子view的约束就不会自适应?

    3 条回复    2015-04-15 15:55:48 +08:00
    66450146
        1
    66450146  
       2015-04-14 22:56:45 +08:00
    修改了 transform 之后就不要再动 frame 了……这段是 frame 的文档里面写的:

    if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified.
    tsinghan
        2
    tsinghan  
    OP
       2015-04-15 08:53:40 +08:00
    @66450146 那我的需求是, 将父view 旋转90度,而且是铺满整个屏幕, 不改frame怎么整?
    Creolophus
        3
    Creolophus  
       2015-04-15 15:55:48 +08:00
    铺满屏幕用CGAffineTransformScale试试
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5980 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 06:12 · PVG 14:12 · LAX 23:12 · JFK 02:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.