什么是错误“应用程序尝试在目标上推送零视图控制器。”?
我的编码是
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
FirstTabBarItem = [[FirstMuseum alloc] init];
SecondTabBarItem = [[SecondMaps alloc] init];
ThirdTabBarItem = [[ThirdExhibition alloc] init];
FourthTabBarItem = [[FourthTabBarItem alloc] init];
first = [[UINavigationController alloc] initWithRootViewController:FirstTabBarItem];
second = [[UINavigationController alloc] initWithRootViewController:SecondTabBarItem];
third = [[UINavigationController alloc] initWithRootViewController:ThirdTabBarItem];
fourth = [[UINavigationController alloc] initWithRootViewController:FourthTabBarItem];
first.title = @"Hello";
second.title = @"Hello";
third.title = @"Hello";
fourth.title = @"Hello";
myControllerArray = [[NSMutableArray alloc] init];
[myControllerArray addObject:first];
[myControllerArray addObject:second];
[myControllerArray addObject:third];
[myControllerArray addObject:fourth];
myTabBar = [[UITabBarController alloc] init];
[myTabBar setViewControllers:myControllerArray];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:myTabBar];
NSLog(@"Hello, You Tapped !"); }
什么错误, 我正在尝试制作一个包含四个项目的 UITabBarController,所以现在我应该做什么 ????
my coding is
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
FirstTabBarItem = [[FirstMuseum alloc] init];
SecondTabBarItem = [[SecondMaps alloc] init];
ThirdTabBarItem = [[ThirdExhibition alloc] init];
FourthTabBarItem = [[FourthTabBarItem alloc] init];
first = [[UINavigationController alloc] initWithRootViewController:FirstTabBarItem];
second = [[UINavigationController alloc] initWithRootViewController:SecondTabBarItem];
third = [[UINavigationController alloc] initWithRootViewController:ThirdTabBarItem];
fourth = [[UINavigationController alloc] initWithRootViewController:FourthTabBarItem];
first.title = @"Hello";
second.title = @"Hello";
third.title = @"Hello";
fourth.title = @"Hello";
myControllerArray = [[NSMutableArray alloc] init];
[myControllerArray addObject:first];
[myControllerArray addObject:second];
[myControllerArray addObject:third];
[myControllerArray addObject:fourth];
myTabBar = [[UITabBarController alloc] init];
[myTabBar setViewControllers:myControllerArray];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:myTabBar];
NSLog(@"Hello, You Tapped !"); }
what is error,
I am trying to make a UITabBarController with four item, so now what should I do
??????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这意味着您尝试推送的视图控制器尚未正确分配。请检查视图控制器的分配情况,看看它是否分配干净
It means the view controller u r trying to push has not been allocated properly. Pls check the allocation of the view controller and see if its allocated cleanly
是的,你可能忘记分配视图控制器,所以试试我的代码:
按钮操作
1)
tapaction
意味着在我的第一个视图中声明的尝试这个你会得到导航
yes you can forgot to allocate view controller so try my code:
1)
tapaction
means button actiondeclared in my firstview
try this you wil get the navigation