Skip to content

Commit

Permalink
Merge pull request #16 from ashchan/top-position-fix
Browse files Browse the repository at this point in the history
Adjustments for iOS 7 View Controller with automaticallyAdjustsScrollVie...
  • Loading branch information
lobianco committed Oct 21, 2013
2 parents db19a6c + 88e6ba2 commit 7df3512
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions ALAlertBanner/ALAlertBanner.m
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,11 @@ - (void)setInitialLayout {
if (isSuperviewKindOfWindow) initialYCoord += kStatusBarHeight;
if (AL_IOS_7_OR_GREATER) {
id nextResponder = [self nextAvailableViewController:self];
if (![nextResponder isKindOfClass:[UITableViewController class]]) {
initialYCoord += [(UIViewController*)nextResponder topLayoutGuide].length;
if (nextResponder) {
UIViewController *vc = nextResponder;
if (!(vc.automaticallyAdjustsScrollViewInsets && [vc.view isKindOfClass:[UIScrollView class]])) {
initialYCoord += [vc topLayoutGuide].length;
}
}
}
break;
Expand Down
7 changes: 5 additions & 2 deletions ALAlertBanner/ALAlertBannerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,11 @@ - (void)didRotate:(NSNotification *)note {
if (AL_IOS_7_OR_GREATER && topBanners.count > 0) {
ALAlertBanner *firstBanner = (ALAlertBanner *)[topBanners objectAtIndex:0];
id nextResponder = [firstBanner nextAvailableViewController:firstBanner];
if (![nextResponder isKindOfClass:[UITableViewController class]]) {
topYCoord += [(UIViewController*)nextResponder topLayoutGuide].length;
if (nextResponder) {
UIViewController *vc = nextResponder;
if (!(vc.automaticallyAdjustsScrollViewInsets && [vc.view isKindOfClass:[UIScrollView class]])) {
topYCoord += [vc topLayoutGuide].length;
}
}
}
for (ALAlertBanner *alertBanner in [topBanners reverseObjectEnumerator]) {
Expand Down

0 comments on commit 7df3512

Please sign in to comment.