Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #1 from williampower/master

status bar use instead of device use for orientation detection
  • Loading branch information...
commit 8080ac3384c087ee242b1207f42e5eb75b1e4d0d 2 parents 2d5fbc6 + 4a539fa
Jeremy Olmsted-Thompson authored

Showing 2 changed files with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. +1 0  SlideMenu/TrayView.h
  2. +7 3 SlideMenu/TrayView.m
1  SlideMenu/TrayView.h
@@ -22,6 +22,7 @@ typedef enum {
22 22 @property (nonatomic, retain) UIImage *backgroundImage;
23 23 @property (nonatomic, assign) TrayPosition trayPosition;
24 24 @property (nonatomic) BOOL tapOffToClose;
  25 +@property (nonatomic) BOOL autoHideOnRotate;
25 26 @property (nonatomic) NSTimeInterval defaultAnimationDuration;
26 27 @property (nonatomic, copy) void (^closedBlock)();
27 28 @property (nonatomic, copy) void (^bouncedBlock)();
10 SlideMenu/TrayView.m
@@ -25,6 +25,7 @@ @implementation TrayView
25 25 @synthesize bouncedBlock = _bouncedBlock;
26 26 @synthesize tapOffToClose = _tapOffToClose;
27 27 @synthesize trayCloseRecognizerView = _trayCloseRecognizerView;
  28 +@synthesize autoHideOnRotate=_autoHideOnRotate;
28 29
29 30 #pragma mark - Lifecycle
30 31
@@ -46,8 +47,8 @@ - (id)initWithFrame:(CGRect)frame {
46 47 _orientation = [[UIApplication sharedApplication] statusBarOrientation];
47 48 _defaultAnimationDuration = 0.25;
48 49 _tapOffToClose = YES;
49   - [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
50   - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
  50 + _autoHideOnRotate = YES;
  51 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationDidChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
51 52 }
52 53 return self;
53 54 }
@@ -292,7 +293,7 @@ -(void)setUIInterfaceOrientation:(UIInterfaceOrientation)orientation supported:(
292 293 }
293 294
294 295 -(void)orientationDidChange:(NSNotification*)note {
295   - UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
  296 + UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
296 297 if (orientation == _orientation || !_supportedOrientations[orientation]) {
297 298 return;
298 299 }
@@ -303,6 +304,9 @@ -(void)orientationDidChange:(NSNotification*)note {
303 304 } completion:^(BOOL finished) {
304 305 self.alpha = 1;
305 306 }];
  307 + if(_autoHideOnRotate){
  308 + [self hide];
  309 + }
306 310 }
307 311 _orientation = orientation;
308 312 }

0 comments on commit 8080ac3

Please sign in to comment.
Something went wrong with that request. Please try again.