Reputation: 15639
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 ??????
Upvotes: 2
Views: 6475
Reputation: 51
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
Upvotes: -1
Reputation: 26400
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
Upvotes: 4