Skip to content

Commit

Permalink
When using underStatusBar draw statusBarView with only navigationBar. F…
Browse files Browse the repository at this point in the history
…ixes #23
  • Loading branch information
Ashton-W committed Feb 20, 2014
1 parent fc397f9 commit c6f8c80
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions CRToast/CRToast.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -294,7 +294,19 @@ - (CGRect)notificationViewAnimationFrame2 {


- (UIView*)statusBarView { - (UIView*)statusBarView {
UIView *statusBarView = [[UIView alloc] initWithFrame:self.statusBarViewAnimationFrame1]; UIView *statusBarView = [[UIView alloc] initWithFrame:self.statusBarViewAnimationFrame1];
[statusBarView addSubview:[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES]]; if ([self underStatusBar]) {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
UIGraphicsBeginImageContextWithOptions(window.frame.size, NO, 0);
CGRect rect = CGRectMake(0, 0, window.frame.size.width, window.frame.size.height);
[window drawViewHierarchyInRect:rect afterScreenUpdates:YES];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *imageView = [[UIImageView alloc] initWithImage:screenshot];
[statusBarView addSubview:imageView];
}
else {
[statusBarView addSubview:[[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES]];
}
statusBarView.clipsToBounds = YES; statusBarView.clipsToBounds = YES;
return statusBarView; return statusBarView;
} }
Expand Down Expand Up @@ -776,7 +788,6 @@ - (void)displayNotification:(CRToast*)notification {
statusBarView.frame = _notificationWindow.rootViewController.view.bounds; statusBarView.frame = _notificationWindow.rootViewController.view.bounds;
[_notificationWindow.rootViewController.view addSubview:statusBarView]; [_notificationWindow.rootViewController.view addSubview:statusBarView];
statusBarView.hidden = notification.presentationType == CRToastPresentationTypeCover; statusBarView.hidden = notification.presentationType == CRToastPresentationTypeCover;
if (notification.underStatusBar) statusBarView.hidden = YES;


UIView *notificationView = notification.notificationView; UIView *notificationView = notification.notificationView;
notificationView.frame = notification.notificationViewAnimationFrame1; notificationView.frame = notification.notificationViewAnimationFrame1;
Expand Down

0 comments on commit c6f8c80

Please sign in to comment.