Skip to content

Commit

Permalink
Replace initializing code into initWithNibName:bundle:. Move gesture …
Browse files Browse the repository at this point in the history
…recognizers setup in viewDidLoad
  • Loading branch information
shemet committed May 31, 2013
1 parent d37b0ac commit 1ef85aa
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ @interface MMDrawerController () <UIGestureRecognizerDelegate>{

@implementation MMDrawerController

#pragma mark - Init

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self setMaximumLeftDrawerWidth:MMDrawerDefaultWidth];
[self setMaximumRightDrawerWidth:MMDrawerDefaultWidth];

[self setAnimationVelocity:MMDrawerDefaultAnimationVelocity];

[self setShowsShadow:YES];
[self setShouldStretchDrawer:YES];

[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeNone];
[self setCenterHiddenInteractionMode:MMDrawerOpenCenterInteractionModeNavigationBarOnly];
}

return self;
}

-(id)initWithCenterViewController:(UIViewController *)centerViewController leftDrawerViewController:(UIViewController *)leftDrawerViewController rightDrawerViewController:(UIViewController *)rightDrawerViewController{
NSParameterAssert(centerViewController);
self = [self init];
Expand All @@ -136,22 +157,6 @@ -(id)initWithCenterViewController:(UIViewController *)centerViewController leftD
[self setCenterViewController:centerViewController];
[self setLeftDrawerViewController:leftDrawerViewController];
[self setRightDrawerViewController:rightDrawerViewController];

[self setMaximumLeftDrawerWidth:MMDrawerDefaultWidth];
[self setMaximumRightDrawerWidth:MMDrawerDefaultWidth];

[self setAnimationVelocity:MMDrawerDefaultAnimationVelocity];

[self setShowsShadow:YES];
[self setShouldStretchDrawer:YES];

[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeNone];
[self setCenterHiddenInteractionMode:MMDrawerOpenCenterInteractionModeNavigationBarOnly];

[self.view setBackgroundColor:[UIColor blackColor]];

[self setupGestureRecognizers];
}
return self;
}
Expand Down Expand Up @@ -545,6 +550,16 @@ -(BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers{
return NO;
}

#pragma mark - View Lifecycle

- (void)viewDidLoad {
[super viewDidLoad];

[self.view setBackgroundColor:[UIColor blackColor]];

[self setupGestureRecognizers];
}

-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.centerViewController beginAppearanceTransition:YES animated:animated];
Expand Down

0 comments on commit 1ef85aa

Please sign in to comment.