Setting a rotation transformation to a UIView or its layer doesn't seem to work?

前端 未结 2 568
再見小時候
再見小時候 2021-01-02 05:53

I\'m trying to have one of the children views in my screen (owned by one view controller) not rotate when the device rotates. My view controller allows rotations as

2条回答
  •  Happy的楠姐
    2021-01-02 06:38

    Is your code actually executed? (Do you implement shouldAutorotateToInterfaceOrientation: ?)

    stuckview.transform = CGAffineTransformMakeRotation(M_PI_2); 
    

    should do the job.

    Note: The functions take radians not degrees.

提交回复
热议问题