Skip to content

Commit

Permalink
Merge pull request #49 from basecom/master
Browse files Browse the repository at this point in the history
Added the ability to hand over supportededInterfaceOrientations
  • Loading branch information
cezarywojcik committed Apr 13, 2015
2 parents e9ba7bd + eef9cc8 commit 437e5c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CWStatusBarNotification/CWStatusBarNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef void(^CWCompletionBlock)(void);

@interface CWViewController : UIViewController
@property (nonatomic) UIStatusBarStyle preferredStatusBarStyle;
@property (nonatomic, setter=setSupportedInterfaceOrientations:) NSInteger supportedInterfaceOrientations;
@end

@interface CWStatusBarNotification : NSObject
Expand Down Expand Up @@ -56,6 +57,7 @@ typedef NS_ENUM(NSInteger, CWNotificationAnimationType) {
@property (copy, nonatomic) CWCompletionBlock notificationTappedBlock;

@property (nonatomic) CWNotificationStyle notificationStyle;
@property (nonatomic) NSInteger supportedInterfaceOrientations;
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationInStyle;
@property (nonatomic) CWNotificationAnimationStyle notificationAnimationOutStyle;
@property (nonatomic) CWNotificationAnimationType notificationAnimationType;
Expand Down
18 changes: 18 additions & 0 deletions CWStatusBarNotification/CWStatusBarNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,29 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event

@end

@interface CWViewController()

@property (nonatomic, assign) NSInteger _cwViewControllerSupportedInterfaceOrientation;

@end

@implementation CWViewController

- (UIStatusBarStyle)preferredStatusBarStyle
{
return _preferredStatusBarStyle;
}

- (void)setSupportedInterfaceOrientations:(NSInteger)supportedInterfaceOrientations
{
self._cwViewControllerSupportedInterfaceOrientation = supportedInterfaceOrientations;
}

- (NSUInteger)supportedInterfaceOrientations
{
return self._cwViewControllerSupportedInterfaceOrientation;
}

@end

# pragma mark - dispatch after with cancellation
Expand Down Expand Up @@ -182,6 +198,7 @@ - (CWStatusBarNotification *)init
self.notificationIsDismissing = NO;
self.isCustomView = NO;
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
self.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;

// create tap recognizer
self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(notificationTapped:)];
Expand Down Expand Up @@ -351,6 +368,7 @@ - (void)createNotificationWindow
self.notificationWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.notificationWindow.windowLevel = UIWindowLevelStatusBar;
CWViewController *rootViewController = [[CWViewController alloc] init];
[rootViewController setSupportedInterfaceOrientations:self.supportedInterfaceOrientations];
rootViewController.preferredStatusBarStyle = self.preferredStatusBarStyle;
self.notificationWindow.rootViewController = rootViewController;
self.notificationWindow.notificationHeight = [self getNotificationLabelHeight];
Expand Down

0 comments on commit 437e5c5

Please # to comment.