UIButton does not receive events after rotation

345 Views Asked by At

I have a view controller with an UIButton. That view controller is shown in landscape right mode only. Until iOS 8.0.2, all works fine. I'm testing with an iPhone 5S.

But after installing iOS 8.1.1, the following happens:

  1. If I click the button just right after the view controller is shown, all works fine. The touch up inside event is received.
  2. But if I start to rotate the phone a few times, even when the view does not change orientation (remember, landscape right only), the events are not received anymore.

Here is the relevant code:

-(BOOL)shouldAutorotate
{
    NSLog(@"shouldAutorotate");
    return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
    NSLog(@"supportedInterfaceOrientations");
    return UIInterfaceOrientationMaskLandscapeRight;
}

I should mention that the method shouldAutorotate is called several times.

Thank you in advance. Any help would be appreciated.

1

There are 1 best solutions below

0
On

If you use only one landscape right mode, try to detect device orientation like here:

Detecting iOS UIDevice orientation