willRotateToInterfaceOrientation not being called

前端 未结 6 1145
暖寄归人
暖寄归人 2020-12-11 02:13

I\'m returning YES in my view controller\'s shouldAutorotateToInterfaceOrientation function, and I can see using breakpoints that YES

6条回答
  •  無奈伤痛
    2020-12-11 02:40

    If you are not receiving callbacks on willAutoRotateToInterfaceOrientation in any view controller, add the view controller as your root view controller's child view controller.

    For Eg; say self.viewController is your root view controller and childViewController is the view controller in which you want to get auto-rotation callbacks, add the following line of code;

    [self.viewController addChildViewController:childViewController];

    Actually, adding as the child view controller to any view controller which gets rotation call backs will work too.

    Hope it helps.

提交回复
热议问题