2

For example I turn off autorotation with this code

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return NO;
}
-(BOOL)shouldAutorotate
{
    return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
    return 0;
}

And my buttons, labels, textFields and other object can rotate according to the current orientation of the device. But keyboard doesn't want to rotate=/ How i can rotate keyboard or i can't. Who knows? Please help) http://www.pictureshack.ru/images/8145_Snimok_ekrana_05_11_2013_18_55_00_s_Simulyatora_iOS.png

Filburt
  • 17,626
  • 12
  • 64
  • 115
nipercop
  • 357
  • 1
  • 11

2 Answers2

1

Keyboard orientation is same as Status Bar orientation.

in image, all your button and text orientation not in orientation of Status Bar.

try following code

-(BOOL)shouldAutorotate
{
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}
Abhishek Panchal
  • 394
  • 1
  • 11
1

OK. Decision proved to be a simple. In my method where i checked device orientation, i add this code and it's working.

    if (deviceOrientation == UIDeviceOrientationPortrait){
         [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
    }
    else if (deviceOrientation == UIDeviceOrientationPortraitUpsideDown){
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown animated:NO];  
    }
    else if (deviceOrientation == UIDeviceOrientationLandscapeLeft){
         [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
    }
    else if (deviceOrientation == UIDeviceOrientationLandscapeRight){
         [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:NO];
}

Hope this helps to someone!)

nipercop
  • 357
  • 1
  • 11