Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TabBar不在iphone中显示_Iphone_Ios_Ipad_Uitabbar - Fatal编程技术网

TabBar不在iphone中显示

TabBar不在iphone中显示,iphone,ios,ipad,uitabbar,Iphone,Ios,Ipad,Uitabbar,我正在使用tabbar,当我导航到该控制器时,我的tabbar不显示 下面是tabbar类的代码 UIViewController * myTruckDept= [[NYTTruckDeparture alloc]initWithSiteName:self.siteNam andSiteDate:self.date]; UIViewController * myEditionStates = [[NYTEditionStats alloc] initWithSiteName:self.siteN

我正在使用tabbar,当我导航到该控制器时,我的tabbar不显示

下面是tabbar类的代码

UIViewController * myTruckDept= [[NYTTruckDeparture alloc]initWithSiteName:self.siteNam andSiteDate:self.date];
UIViewController * myEditionStates = [[NYTEditionStats alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myPagingData = [[NYTPagingData alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myDownTimeLog = [[NYTDowntimeLog alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myComments = [[NYTComments alloc] initWithSiteName:self.siteName andSiteDate:self.date];

NSArray *array = [[NSArray alloc] initWithObjects:myTruckDept, myEditionStates, myPagingData, myDownTimeLog, myComments, nil];

self.viewControllersArray = array;
[self.view addSubview:myTruckDept.view];
self.selectedViewController = myTruckDept;
self.myTabBar.selectedItem=self.myTruckDeptTabBarItem;
当我将此视图控制器推送到导航控制器时,当导航栏未隐藏时会显示选项卡栏,当我隐藏导航栏并立即使用工具栏时,底部的选项卡栏不会显示


需要快速回复,请提前致谢。

//定义UIViewController

UIViewController * myTruckDept= [[NYTTruckDeparture alloc]initWithSiteName:self.siteNam andSiteDate:self.date];
UIViewController * myEditionStates = [[NYTEditionStats alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myPagingData = [[NYTPagingData alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myDownTimeLog = [[NYTDowntimeLog alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myComments = [[NYTComments alloc] initWithSiteName:self.siteName andSiteDate:self.date];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects: myTruckDeptNavC, topyummsNavC, myEditionStatesNavC ,myDownTimeLogNavC , myCommentsNavC, nil];
self.tabBarController.delegate = self;
//在UINavigation控制器中添加视图

UINavigationController * myTruckDeptNavC = [[UINavigationController alloc] initWithRootViewController: myTruckDept];
UINavigationController *topyummsNavC = [[UINavigationController alloc] initWithRootViewController: myEditionStates];
UINavigationController *myEditionStatesNavC = [[UINavigationController alloc] initWithRootViewController: myPagingData];
UINavigationController * myDownTimeLogNavC = [[UINavigationController alloc] initWithRootViewController: myDownTimeLog];
UINavigationController * myCommentsNavC = [[UINavigationController alloc] initWithRootViewController:myComments];
//隐藏导航栏

myTruckDeptNavC.navigationBar.hidden = YES;
topyummsNavC .navigationBar.hidden = YES;
myEditionStatesNavC.navigationBar.hidden = YES;
myDownTimeLogNavC .navigationBar.hidden = YES;
myComments NavC.navigationBar.hidden = YES;
//初始化选项卡栏并设置控制器

UIViewController * myTruckDept= [[NYTTruckDeparture alloc]initWithSiteName:self.siteNam andSiteDate:self.date];
UIViewController * myEditionStates = [[NYTEditionStats alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myPagingData = [[NYTPagingData alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myDownTimeLog = [[NYTDowntimeLog alloc] initWithSiteName:self.siteName andSiteDate:self.date];
UIViewController * myComments = [[NYTComments alloc] initWithSiteName:self.siteName andSiteDate:self.date];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects: myTruckDeptNavC, topyummsNavC, myEditionStatesNavC ,myDownTimeLogNavC , myCommentsNavC, nil];
self.tabBarController.delegate = self;
//可编程条

[self.window.rootViewController presentModalViewController:self.tabBarController animated:animated];

希望有此帮助。

尝试使用此代码创建自定义tabbarController。在这里,我创建了两个,你可以使它4容易

要了解更多信息,请查看我的答案:


如果您仍然不明白,请参考参考链接中的以下步骤