diff --git a/EAIntroView/EAIntroView.m b/EAIntroView/EAIntroView.m index bb533a0..4b6ca6c 100644 --- a/EAIntroView/EAIntroView.m +++ b/EAIntroView/EAIntroView.m @@ -199,22 +199,6 @@ - (void)notifyDelegateWithPreviousPage:(NSUInteger)previousPageIndex andCurrentP } } --(void)willMoveToSuperview:(UIView *)newSuperview { - [super willMoveToSuperview:newSuperview]; - if (self.superview == nil && newSuperview != nil) { - // Add observer for device orientation: - [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(deviceOrientationDidChange:) - name:UIDeviceOrientationDidChangeNotification - object:nil]; - } else if (self.superview != nil && newSuperview == nil) { - // Remove observer for rotation - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; - } -} - #pragma mark - Properties - (EARestrictedScrollView *)scrollView { @@ -674,9 +658,11 @@ - (void)crossDissolveForOffset:(CGFloat)offset { } } -#pragma mark - Notifications +#pragma mark - UIView lifecycle calls + +- (void)layoutSubviews { + [super layoutSubviews]; -- (void)deviceOrientationDidChange:(NSNotification *)notification { // Get amount of pages: NSInteger numberOfPages = _pages.count;