yogevbd 6 years ago
parent
commit
1f243750bd
3 changed files with 32 additions and 17 deletions
  1. 1
    1
      lib/ios/RNNSideMenuController.m
  2. 1
    0
      lib/ios/RNNSideMenuSideOptions.h
  3. 30
    16
      lib/ios/RNNSideMenuSideOptions.m

+ 1
- 1
lib/ios/RNNSideMenuController.m View File

@@ -31,7 +31,7 @@
31 31
 	
32 32
 	self.sideMenu.openDrawerGestureModeMask = MMOpenDrawerGestureModeAll;
33 33
 	self.sideMenu.closeDrawerGestureModeMask = MMCloseDrawerGestureModeAll;
34
-	
34
+
35 35
 	[self addChildViewController:self.sideMenu];
36 36
 	[self.sideMenu.view setFrame:self.view.bounds];
37 37
 	[self.view addSubview:self.sideMenu.view];

+ 1
- 0
lib/ios/RNNSideMenuSideOptions.h View File

@@ -7,5 +7,6 @@
7 7
 
8 8
 @property (nonatomic, strong) NSNumber* visible;
9 9
 @property (nonatomic, strong) NSNumber* enabled;
10
+@property (nonatomic, strong) NSNumber* width;
10 11
 
11 12
 @end

+ 30
- 16
lib/ios/RNNSideMenuSideOptions.m View File

@@ -5,23 +5,37 @@
5 5
 
6 6
 - (void)applyOnSide:(MMDrawerSide)side viewController:(UIViewController *)viewController {
7 7
 	RNNSideMenuController* sideMenuController = (RNNSideMenuController*)UIApplication.sharedApplication.delegate.window.rootViewController;
8
-	if (self.enabled) {
9
-		switch (side) {
10
-			case MMDrawerSideRight:
11
-				sideMenuController.sideMenu.rightSideEnabled = [self.enabled boolValue];
12
-				break;
13
-			case MMDrawerSideLeft:
14
-				sideMenuController.sideMenu.leftSideEnabled = [self.enabled boolValue];
15
-			default:
16
-				break;
8
+	if (sideMenuController && [sideMenuController isKindOfClass:[RNNSideMenuController class]]) {
9
+		if (self.enabled) {
10
+			switch (side) {
11
+				case MMDrawerSideRight:
12
+					sideMenuController.sideMenu.rightSideEnabled = [self.enabled boolValue];
13
+					break;
14
+				case MMDrawerSideLeft:
15
+					sideMenuController.sideMenu.leftSideEnabled = [self.enabled boolValue];
16
+				default:
17
+					break;
18
+			}
17 19
 		}
18
-	}
19
-	
20
-	if (self.visible) {
21
-		if (self.visible.boolValue) {
22
-			[sideMenuController showSideMenu:side animated:YES];
23
-		} else {
24
-			[sideMenuController hideSideMenu:side animated:YES];
20
+		
21
+		if (self.visible) {
22
+			if (self.visible.boolValue) {
23
+				[sideMenuController showSideMenu:side animated:YES];
24
+			} else {
25
+				[sideMenuController hideSideMenu:side animated:YES];
26
+			}
27
+		}
28
+
29
+		if (self.width) {
30
+			switch (side) {
31
+				case MMDrawerSideRight:
32
+					sideMenuController.sideMenu.maximumRightDrawerWidth = self.width.floatValue;
33
+					break;
34
+				case MMDrawerSideLeft:
35
+					sideMenuController.sideMenu.maximumLeftDrawerWidth = self.width.floatValue;
36
+				default:
37
+					break;
38
+			}
25 39
 		}
26 40
 	}
27 41