yogevbd 6 years ago
parent
commit
466010f76e
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      lib/ios/RNNRootViewController.m

+ 2
- 2
lib/ios/RNNRootViewController.m View File

172
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
172
 			_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:self.navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
173
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
173
 			[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
174
 			self.navigationController.navigationBar.clipsToBounds = YES;
174
 			self.navigationController.navigationBar.clipsToBounds = YES;
175
-		} else if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
175
+		} else if (self.navigationController.navigationBar.subviews.count && [[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
176
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
176
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
177
 			self.navigationController.navigationBar.clipsToBounds = NO;
177
 			self.navigationController.navigationBar.clipsToBounds = NO;
178
 		}
178
 		}
179
 	} if (_customTopBarBackground && _customTopBarBackground.superview == nil) {
179
 	} if (_customTopBarBackground && _customTopBarBackground.superview == nil) {
180
-		if ([[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
180
+		if (self.navigationController.navigationBar.subviews.count && [[self.navigationController.navigationBar.subviews objectAtIndex:1] isKindOfClass:[RNNCustomTitleView class]]) {
181
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
181
 			[[self.navigationController.navigationBar.subviews objectAtIndex:1] removeFromSuperview];
182
 		}
182
 		}
183
 		[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
183
 		[self.navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];