Skip to content

Commit

Permalink
[FIX] Issue #2; shadow on iOS 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sudeep committed Oct 1, 2016
1 parent dc45f5d commit df32a3e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ASJOverflowButton/ASJOverflowMenu.m
Expand Up @@ -98,11 +98,19 @@ - (void)layoutSubviews
{
[super layoutSubviews];

// fixes shadow being drawn incorrectly
[self layoutIfNeeded];

[self setupShadow];
[self animateMenu];
/**
* Fix for Issue #2: https://github.com/sudeepjaiswal/ASJOverflowButton/issues/2
* Thanks: http://stackoverflow.com/a/39647683
* Weirdly, iOS 10 requires this stuff to be done on the main queue, else the menu position and shadow bounds don't set correctly, even though there is a call to focefully layout the view if needed. This was done earlier to fix shadow bounds in iOS 9
*/
[[NSOperationQueue mainQueue] addOperationWithBlock:^
{
// fixes shadow being drawn incorrectly. worked for iOS 9
[self layoutIfNeeded];

[self setupShadow];
[self animateMenu];
}];
}

- (void)setupShadow
Expand Down

0 comments on commit df32a3e

Please sign in to comment.