cdts/xdts-ios 3/TreeHole/Code/AppDelegate+THCustomTabBarController.m

78 lines
2.4 KiB
Mathematica
Raw Permalink Normal View History

2023-07-27 09:20:00 +08:00
//
// AppDelegate+THCustomTabBarController.m
// TreeHole
//
// Created by iOS on 2023/2/10.
// Copyright © 2023 CYH. All rights reserved.
//
#import "AppDelegate+THCustomTabBarController.h"
#import "THTabBarViewController.h"
#import "THTabBarItemGifPlusButton.h"
#import "THNavigationController.h"
@implementation AppDelegate (THCustomTabBarController)
- (void)setupCustomTabBarControllerAndAppearance {
if (!self.window) {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
}
THTabBarViewController *tabVC = [THTabBarViewController new];
// tabVC.tabBarItemsAttributes = [self tabBarItemsAttributesForController];
tabVC.viewControllers = [self viewControllers];
// [THTabBarItemGifPlusButton registerPlusButton];
self.window.rootViewController = tabVC;
[self.window makeKeyAndVisible];
}
- (NSArray *)viewControllers {
THViewController *homeVC = [[THViewController alloc] init];
homeVC.view.backgroundColor = [UIColor qmui_randomColor];
UIViewController *homeNav = [[THNavigationController alloc] initWithRootViewController:homeVC];
// [homeVC cyl_setHideNavigationBarSeparator:YES];
THViewController *nearVC = [[THViewController alloc] init];
nearVC.view.backgroundColor = [UIColor qmui_randomColor];
UIViewController *nearNav = [[THNavigationController alloc] initWithRootViewController:nearVC];
// [nearVC cyl_setHideNavigationBarSeparator:YES];
NSArray *viewControllers = @[
homeNav,
nearNav,
];
return viewControllers;
}
- (NSArray *)tabBarItemsAttributesForController {
NSDictionary *firstTabBarItemsAttributes = @{
CYLTabBarItemTitle : @"首页",
CYLTabBarItemImage : @"TH_TabBarBaseLocalNormal",
CYLTabBarItemSelectedImage : @"TH_TabBarBaseLocalSelected",
};
NSDictionary *secondTabBarItemsAttributes = @{
CYLTabBarItemTitle : @"鱼塘",
CYLTabBarItemImage :@"TH_TabBarMsgNormal",
CYLTabBarItemSelectedImage : @"TH_TabBarMsgSelected",
};
// NSDictionary *thirdTabBarItemsAttributes = @{
// CYLTabBarItemTitle : @"我的",
// CYLTabBarItemImage :@"fishpond_normal",
// CYLTabBarItemSelectedImage : @"fishpond_highlight",
// };
NSArray *tabBarItemsAttributes = @[
firstTabBarItemsAttributes,
secondTabBarItemsAttributes,
// thirdTabBarItemsAttributes
];
return tabBarItemsAttributes;
}
@end