Permalink
Browse files

When using underStatusBar draw statusBarView with only navigationBar. F…

…ixes #23
  • Loading branch information...
1 parent fc397f9 commit c6f8c80da1f398778166bad00386d142431a8688 @Ashton-W Ashton-W committed Feb 20, 2014
Showing with 13 additions and 2 deletions.
  1. +13 −2 CRToast/CRToast.m
View
@@ -294,7 +294,19 @@ - (CGRect)notificationViewAnimationFrame2 {
- (UIView*)statusBarView {
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;
return statusBarView;
}
@@ -776,7 +788,6 @@ - (void)displayNotification:(CRToast*)notification {
statusBarView.frame = _notificationWindow.rootViewController.view.bounds;
[_notificationWindow.rootViewController.view addSubview:statusBarView];
statusBarView.hidden = notification.presentationType == CRToastPresentationTypeCover;
- if (notification.underStatusBar) statusBarView.hidden = YES;
UIView *notificationView = notification.notificationView;
notificationView.frame = notification.notificationViewAnimationFrame1;

0 comments on commit c6f8c80

Please sign in to comment.