gpt4 book ai didi

Tab bar does not appear in iOS(IOS中未显示选项卡栏)

转载 作者:bug小助手 更新时间:2023-10-25 19:25:56 25 4
gpt4 key购买 nike



I am trying to make an iOS hybrid app, but I'm stuck on the first step;
my app does not show its tab bar like this pic tab bar not show

我正在尝试制作一款iOS混合应用程序,但我停留在第一步;我的应用程序没有像这个图片选项卡栏那样显示它的选项卡栏


My debug result shows in UITabBarController the self.tabBar.subviews.subviews is empty when i try to traverse it, it throw an exception;error

我的调试结果显示,在UITabBarController中,self.tabBar.subviews.subviews为空。当我尝试遍历它时,它抛出异常;错误


here is the code;

以下是代码;


// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
BaseTabbarViewController *tabbarVC = [[BaseTabbarViewController alloc]init];
self.window.rootViewController = tabbarVC;
[self.window makeKeyAndVisible];
return YES;
}
//BaseTabbarViewController.m`
- (void)viewDidLoad {
[super viewDidLoad];
self.tabBar.barTintColor = [UIColor whiteColor];
[self setupChildVC];
self.indexFlag = 0;
}
- (void)setupChildVC {
OKRWebViewController *okrMainVC = [[OKRWebViewController alloc] initWithConfig:@"http://192.168.2.183:8080/OKRMain?enable_bounds=0&hide_scroll_bar=1"];
[self setupTabbarItem:okrMainVC.tabBarItem title:@"main" titleSize:12 titleFontName:@"HeiTi SC" normalTitleColor:[UIColor grayColor] selectedTitleColor:[UIColor purpleColor] normalImage:@"tabbar_about_normal" selectedImage:@"tabar_select2"];
OKRWebViewController *okrMainVC2 = [[OKRWebViewController alloc] initWithConfig:@"http://192.168.2.183:8080/OKRMain?enable_bounds=0&hide_scroll_bar=1"];
[self setupTabbarItem:okrMainVC2.tabBarItem title:@"order" titleSize:12 titleFontName:@"HeiTi SC" normalTitleColor:[UIColor grayColor] selectedTitleColor:[UIColor purpleColor] normalImage:@"tabbar_order_normal" selectedImage:@"tabar_select2"];
BaseNavigationController *navA = [[BaseNavigationController alloc]initWithRootViewController:okrMainVC];
BaseNavigationController *navB = [[BaseNavigationController alloc]initWithRootViewController:okrMainVC2];
self.viewControllers = @[navA,navB];
}
- (void)upAnimationWithIndex:(NSInteger)index {
NSMutableArray *tabBarButtonImageArray = [NSMutableArray array];
for (UIControl *tabBarButton in self.tabBar.subviews) {
if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
for (UIView *imageView in tabBarButton.subviews) { // throw exception
if ([imageView isKindOfClass:NSClassFromString(@"UITabBarSwappableImageView")]) {
[tabBarButtonImageArray addObject:imageView];
}
}
}
}
}

found some demos and I forked the code but that didn't work either, I'm not sure if different configurations would cause the issue;

我发现了一些演示,我编写了代码,但这也不起作用,我不确定不同的配置是否会导致问题;


https://github.com/PrincessSmall/TabBarConteollerDemo#tabbarconteollerdemo

Https://github.com/PrincessSmall/TabBarConteollerDemo#tabbarconteollerdemo


更多回答
优秀答案推荐
更多回答

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com