Added the ability to hand over supportededInterfaceOrientations for CWStatusBarNotification. This is optional and the standard value is to support all masks.
This commit is contained in:
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface CWViewController()
|
||||
|
||||
@property (nonatomic, assign) NSInteger _cwViewControllerSupportedInterfaceOrientation;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CWViewController
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
@@ -45,6 +51,16 @@
|
||||
return _preferredStatusBarStyle;
|
||||
}
|
||||
|
||||
- (void)setSupportedInterfaceOrientations:(NSInteger)supportedInterfaceOrientations
|
||||
{
|
||||
self._cwViewControllerSupportedInterfaceOrientation = supportedInterfaceOrientations;
|
||||
}
|
||||
|
||||
- (NSUInteger)supportedInterfaceOrientations
|
||||
{
|
||||
return self._cwViewControllerSupportedInterfaceOrientation;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
# pragma mark - dispatch after with cancellation
|
||||
@@ -182,6 +198,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
self.notificationIsDismissing = NO;
|
||||
self.isCustomView = NO;
|
||||
self.preferredStatusBarStyle = UIStatusBarStyleDefault;
|
||||
self.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;
|
||||
|
||||
// create tap recognizer
|
||||
self.tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(notificationTapped:)];
|
||||
@@ -351,6 +368,7 @@ static void cancel_delayed_block(CWDelayedBlockHandle delayedHandle)
|
||||
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];
|
||||
|
||||
Reference in New Issue
Block a user