tsinghan
V2EX  ›  iOS

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

  •  
  •   tsinghan · Apr 14, 2015 · 3253 views
    This topic created in 4074 days ago, the information mentioned may be changed or developed.

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

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

    3 replies    2015-04-15 15:55:48 +08:00
    66450146
        1
    66450146  
       Apr 14, 2015
    修改了 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
       Apr 15, 2015
    @66450146 那我的需求是, 将父view 旋转90度,而且是铺满整个屏幕, 不改frame怎么整?
    Creolophus
        3
    Creolophus  
       Apr 15, 2015
    铺满屏幕用CGAffineTransformScale试试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   940 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:48 · PVG 03:48 · LAX 12:48 · JFK 15:48
    ♥ Do have faith in what you're doing.