How to push Viewcontroller with TabbarController? In Viewcontroller\'XIB, i created UITabbarController. Then i push this ViewController, but it not appear UITabbarController
If You want to use UITabBarController in your UIViewController class then use this below code...
UIViewController .h Class -
@property (nonatomic, retain) UITabBarController *tab;
UIViewController .m Class -
Add this in ViewDidLoad method...
self.tab=[[UITabBarController alloc]init];
// FirstViewController
First *fvc=[[First alloc]initWithNibName:nil bundle:nil];
fvc.title=@"First";
fvc.tabBarItem.image=[UIImage imageNamed:@"i.png"];
//SecondViewController
Second *svc=[[Second alloc]initWithNibName:nil bundle:nil];
svc.title=@"Second";
svc.tabBarItem.image=[UIImage imageNamed:@"im.png"];
//ThirdViewController
Third *tvc=[[Third alloc]initWithNibName:nil bundle:nil];
tvc.title=@"Third";
tvc.tabBarItem.image=[UIImage imageNamed:@"img.png"];
self.tab.viewControllers=[NSArray arrayWithObjects:fvc, svc, tvc, nil];
[self.view addSubview:self.tab.view];
here First, Second and Third are three different UIViewControllers. And you don't need to give the action on Tabs.
It will work...