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 = @"He开发者_JAVA百科llo";
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 ??????
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
yes you can forgot to allocate view controller so try my code:
1) tapaction
means button action
_forgotviewcontroller means my second view property eg:
@property (nonatomic,strong) ForgotPassword *forgotviewController;
declared in my firstview
-(void) tapAction:(id)sender
{
_forgotviewController=[[ForgotPassword alloc]init];
[self.navigationController pushViewController:self.forgotviewController animated:YES];
}
try this you wil get the navigation
精彩评论