Skip to content

Shadow renders incorrectly on Rotation in iOS 9 #220

@tommylee-fl

Description

@tommylee-fl

We ran into issues where the shadow does not change on rotation.

Possible Solution

For us, we pulled the shadow draw methods up to the root view controller, but here's what we did:

We need to redraw the shadow on rotation.
We added a delegate method that redraws the menu on the completion of a rotation.

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
  [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
   {
   } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
   {
        if(self.shadowEnabled) [self drawMenuShadows];
   }];

  [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

Since we're redrawing the menu at the end of the rotation, and interfaceOrientation is deprecated at iOS 8, we could return only the width and height.

- (CGSize)sizeAdjustedForInterfaceOrientation:(UIView *)view {
        return CGSizeMake(view.frame.size.width, view.frame.size.height);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions