我的编码是
- (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,所以现在该怎么做 ??????
答案 0 :(得分:4)
这意味着尝试推送的视图控制器尚未正确分配。请检查视图控制器的分配,看看它是否干净地分配
答案 1 :(得分:-1)
是的,你可以忘记分配视图控制器,所以试试我的代码:
1)tapaction
表示按钮操作
_forgotviewcontroller means my second view property eg:
@property (nonatomic,strong) ForgotPassword *forgotviewController;
在我的第一次观看中声明
-(void) tapAction:(id)sender
{
_forgotviewController=[[ForgotPassword alloc]init];
[self.navigationController pushViewController:self.forgotviewController animated:YES];
}
试试这个你会得到导航