Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initWithCoder: support #81

Merged
merged 6 commits into from
Aug 14, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,15 @@ @implementation MMDrawerController
- (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 commonInit_MMDrawerController];
}
return self;
}

[self setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
[self setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeNone];
[self setCenterHiddenInteractionMode:MMDrawerOpenCenterInteractionModeNavigationBarOnly];
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self commonInit_MMDrawerController];
}
return self;
}
Expand All @@ -170,6 +168,21 @@ -(id)initWithCenterViewController:(UIViewController *)centerViewController right
return [self initWithCenterViewController:centerViewController leftDrawerViewController:nil rightDrawerViewController:rightDrawerViewController];
}

-(void)commonInit_MMDrawerController
{
[self setMaximumLeftDrawerWidth:MMDrawerDefaultWidth];
[self setMaximumRightDrawerWidth:MMDrawerDefaultWidth];

[self setAnimationVelocity:MMDrawerDefaultAnimationVelocity];

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

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

#pragma mark - Open/Close methods
-(void)toggleDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated completion:(void (^)(BOOL finished))completion{
NSParameterAssert(drawerSide!=MMDrawerSideNone);
Expand Down