react-native-navigation的迁移库

UITabBarController+RNNUtils.m 832B

1234567891011121314151617181920212223242526272829
  1. #import "UITabBarController+RNNUtils.h"
  2. #import "UIView+Utils.h"
  3. @implementation UITabBarController (RNNUtils)
  4. - (UIView *)getTabView:(int)tabIndex {
  5. int index = 0;
  6. for (UIView *view in [[self tabBar] subviews]) {
  7. if ([NSStringFromClass([view class]) isEqualToString:@"UITabBarButton"]) {
  8. if (index == tabIndex) return view;
  9. index++;
  10. }
  11. }
  12. return nil;
  13. }
  14. - (UIView *)getTabIcon:(int)tabIndex {
  15. UIView *tab = [self getTabView:tabIndex];
  16. return [tab findChildByClass:[UIImageView class]];
  17. }
  18. - (NSArray *)deselectedViewControllers {
  19. NSMutableArray* childViewControllers = [NSMutableArray arrayWithArray:self.childViewControllers];
  20. [childViewControllers removeObject:self.selectedViewController];
  21. return [NSArray arrayWithArray:childViewControllers];
  22. }
  23. @end