Note that there are some explanatory texts on larger screens.

plurals
  1. POstopping a rotation notification from propagating to the child views
    primarykey
    data
    text
    <p>i'm using device orientation notification in order to know if the device has been rotated so that i can perform a selector. here is the code i'm using:</p> <pre><code>- (void)awakeFromNib { isShowingLandscapeView = NO; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; } - (void)orientationChanged:(NSNotification *)notification { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (UIDeviceOrientationIsLandscape(deviceOrientation) &amp;&amp; !isShowingLandscapeView) { [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; [self performSegueWithIdentifier:@"landscape" sender:self]; isShowingLandscapeView = YES; } else if (UIDeviceOrientationIsPortrait(deviceOrientation) &amp;&amp; isShowingLandscapeView) { [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; [self dismissViewControllerAnimated:YES completion:nil]; isShowingLandscapeView = NO; } } </code></pre> <p>however, when i navigate to the other child views and rotate the device, the selector is performed although the above code are in a class that is independent from the classes that the other views have. so how can i stop that? i tried:</p> <pre><code>[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; </code></pre> <p>and it also didn't work. my app actually pop into another view in landscape mode when the device is rotated. so in the child views, the landscape view appears in i rotate the device. how can i fix that?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload