How to detect Orientation Change in Custom Keyboard Extension in iOS 8?

后端 未结 10 1914

In Custom Keyboard Extension , we can\'t use

`didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation` 

and

10条回答
  •  时光说笑
    2020-12-04 18:15

    Before iOS 8.3, you have to use

    -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                   duration:(NSTimeInterval)duration
    

    This one does not work (it should be a bug):

    -(void)viewWillTransitionToSize:(CGSize)size
          withTransitionCoordinator:(id)coordinator
    

    On iOS 8.3 and later, you'd better use

    -(void)viewWillTransitionToSize:(CGSize)size
          withTransitionCoordinator:(id)coordinator
    

    because

    -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                   duration:(NSTimeInterval)duration
    

    is deprecated.

提交回复
热议问题