Orientation in a UIView added to a UIWindow

后端 未结 6 1866
眼角桃花
眼角桃花 2020-11-28 01:21

I have a UIView which is supposed to cover the whole device (UIWindow) to support an image zoom in/out effect I\'m doing using core animation where a user taps a button on a

6条回答
  •  渐次进展
    2020-11-28 02:23

    This is because as you mention your view has been added directly to the UIWindow, therefore when the method to rotate is called for the navigation controller nothing happens to the uiview. The UIView would rotate if it was a subview of the view controller view. If for some reason this cannot be done. Then you could override this method:

    // This method is called every time the device changes orientation
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    }
    

    And every time your orientation changes also change your view orientation.

提交回复
热议问题