Browse Source

Remove duplicate setDefaultOptions in UIViewController categories (#5448)

This is already defined in UIViewController+LayoutProtocol and depending 
on the load order will actually prevent the default orders from being 
set
Danilo Bürger 5 years ago
parent
commit
0d31e30800
2 changed files with 7 additions and 13 deletions
  1. 0
    2
      lib/ios/UIViewController+RNNOptions.h
  2. 7
    11
      lib/ios/UIViewController+RNNOptions.m

+ 0
- 2
lib/ios/UIViewController+RNNOptions.h View File

6
 
6
 
7
 @interface UIViewController (RNNOptions)
7
 @interface UIViewController (RNNOptions)
8
 
8
 
9
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions;
10
-
11
 - (void)rnn_setBackgroundImage:(UIImage *)backgroundImage;
9
 - (void)rnn_setBackgroundImage:(UIImage *)backgroundImage;
12
 
10
 
13
 - (void)rnn_setModalPresentationStyle:(UIModalPresentationStyle)modalPresentationStyle;
11
 - (void)rnn_setModalPresentationStyle:(UIModalPresentationStyle)modalPresentationStyle;

+ 7
- 11
lib/ios/UIViewController+RNNOptions.m View File

10
 
10
 
11
 @implementation UIViewController (RNNOptions)
11
 @implementation UIViewController (RNNOptions)
12
 
12
 
13
-- (void)setDefaultOptions:(RNNNavigationOptions *)defaultOptions {
14
-
15
-}
16
-
17
 - (void)rnn_setBackgroundImage:(UIImage *)backgroundImage {
13
 - (void)rnn_setBackgroundImage:(UIImage *)backgroundImage {
18
 	if (backgroundImage) {
14
 	if (backgroundImage) {
19
 		UIImageView* backgroundImageView = (self.view.subviews.count > 0) ? self.view.subviews[0] : nil;
15
 		UIImageView* backgroundImageView = (self.view.subviews.count > 0) ? self.view.subviews[0] : nil;
21
 			backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
17
 			backgroundImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
22
 			[self.view insertSubview:backgroundImageView atIndex:0];
18
 			[self.view insertSubview:backgroundImageView atIndex:0];
23
 		}
19
 		}
24
-		
20
+
25
 		backgroundImageView.layer.masksToBounds = YES;
21
 		backgroundImageView.layer.masksToBounds = YES;
26
 		backgroundImageView.image = backgroundImage;
22
 		backgroundImageView.image = backgroundImage;
27
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
23
 		[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
36
 	self.modalTransitionStyle = modalTransitionStyle;
32
 	self.modalTransitionStyle = modalTransitionStyle;
37
 }
33
 }
38
 
34
 
39
-- (void)rnn_setSearchBarWithPlaceholder:(NSString *)placeholder 
35
+- (void)rnn_setSearchBarWithPlaceholder:(NSString *)placeholder
40
 						hideNavBarOnFocusSearchBar:(BOOL)hideNavBarOnFocusSearchBar {
36
 						hideNavBarOnFocusSearchBar:(BOOL)hideNavBarOnFocusSearchBar {
41
 	if (@available(iOS 11.0, *)) {
37
 	if (@available(iOS 11.0, *)) {
42
 		if (!self.navigationItem.searchController) {
38
 		if (!self.navigationItem.searchController) {
52
 			search.hidesNavigationBarDuringPresentation = hideNavBarOnFocusSearchBar;
48
 			search.hidesNavigationBarDuringPresentation = hideNavBarOnFocusSearchBar;
53
 			self.navigationItem.searchController = search;
49
 			self.navigationItem.searchController = search;
54
 			[self.navigationItem setHidesSearchBarWhenScrolling:NO];
50
 			[self.navigationItem setHidesSearchBarWhenScrolling:NO];
55
-			
51
+
56
 			// Fixes #3450, otherwise, UIKit will infer the presentation context to be the root most view controller
52
 			// Fixes #3450, otherwise, UIKit will infer the presentation context to be the root most view controller
57
 			self.definesPresentationContext = YES;
53
 			self.definesPresentationContext = YES;
58
 		}
54
 		}
161
 		return YES;
157
 		return YES;
162
 	if([[[self tabBarController] presentingViewController] isKindOfClass:[UITabBarController class]])
158
 	if([[[self tabBarController] presentingViewController] isKindOfClass:[UITabBarController class]])
163
 		return YES;
159
 		return YES;
164
-	
160
+
165
 	return NO;
161
 	return NO;
166
 }
162
 }
167
 
163
 
182
 		[self.navigationController.navigationBar setBackIndicatorImage:[UIImage new]];
178
 		[self.navigationController.navigationBar setBackIndicatorImage:[UIImage new]];
183
 		[self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:[UIImage new]];
179
 		[self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:[UIImage new]];
184
 	}
180
 	}
185
-	
181
+
186
 	UIViewController *lastViewControllerInStack = self.navigationController.viewControllers.count > 1 ? self.navigationController.viewControllers[self.navigationController.viewControllers.count - 2] : self.navigationController.topViewController;
182
 	UIViewController *lastViewControllerInStack = self.navigationController.viewControllers.count > 1 ? self.navigationController.viewControllers[self.navigationController.viewControllers.count - 2] : self.navigationController.topViewController;
187
-	
183
+
188
 	backItem.title = title ? title : lastViewControllerInStack.navigationItem.title;
184
 	backItem.title = title ? title : lastViewControllerInStack.navigationItem.title;
189
 	backItem.tintColor = color;
185
 	backItem.tintColor = color;
190
-	
186
+
191
 	lastViewControllerInStack.navigationItem.backBarButtonItem = backItem;
187
 	lastViewControllerInStack.navigationItem.backBarButtonItem = backItem;
192
 }
188
 }
193
 
189