Keyboard appears in wrong orientation in ios

前端 未结 4 1403
耶瑟儿~
耶瑟儿~ 2021-01-21 22:32

I have one viewcontroller in application that supports landscape and portrait orientations.

On a button click, a popup appears where I should enter the nam

4条回答
  •  不要未来只要你来
    2021-01-21 23:05

    Create subclass of UIAlertController

    MyAlertController.h //header file
    @interface MyAlertController : UIAlertController
    
    @end
    
    MyAlertController.m
    @implementation MyAlertController 
    
    - (BOOL)shouldAutorotate
    {
      return NO;
    }
    
    -(UIInterfaceOrientationMask)supportedInterfaceOrientations
    {
      [super supportedInterfaceOrientations];    
      return UIInterfaceOrientationMaskLandscape;
    }
    @end
    

提交回复
热议问题