tsinghan
V2EX  ›  iOS

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

  •  
  •   tsinghan · Apr 14, 2015 · 3710 views
    This topic created in 4221 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
    66450146
    Apr 14, 2015
    1
    修改了 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
    tsinghan
    OP
    Apr 15, 2015
    2
    @66450146 那我的需求是, 将父view 旋转90度,而且是铺满整个屏幕, 不改frame怎么整?
    Creolophus
    Creolophus
    Apr 15, 2015
    3
    铺满屏幕用CGAffineTransformScale试试
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4257 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 01:08 · PVG 09:08 · LAX 17:08 · JFK 20:08
    ♥ Do have faith in what you're doing.