在我的应用程序中,我通过单击viewcontroller中的按钮将我的应用程序设置为tabbarcontroller 我想在第三个tabbar按钮的位置添加一个UIButton,怎么做? 我已经按照this教程(可能是最好的) - 但没有得到一个想法
我正在创建像这样的标签栏
在ViewController.h中
@property (strong,nonatomic) IBOutlet UIViewController *myhomeVC,*groupVC,*uploadVC;
@property (nonatomic,strong) NSMutableArray *Array;
@property (strong,nonatomic) IBOutlet UINavigationController *homeNavBar,*groupNavBar,*uploadNavBar;
在ViewController.m
中 -(IBAction)Login:(id)sender{
Array = [[NSMutableArray alloc] initWithCapacity:5];
myhomeVC = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
homeNavBar=[[UINavigationController alloc]initWithRootViewController:myhomeVC];
homeNavBar.tabBarItem.title=@"First";
groupVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
groupNavBar=[[UINavigationController alloc]initWithRootViewController:groupVC];
groupNavBar.tabBarItem.title=@"Second";
uploadVC = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
uploadNavBar=[[UINavigationController alloc]initWithRootViewController:uploadVC];
uploadNavBar.tabBarItem.title=@"Third";
[Array addObject:homeNavBar];
[Array addObject:groupNavBar];
[Array addObject:uploadNavBar];
appDelegate.tabBarController.viewControllers = localViewControllersArray;
[self.parentViewController.view setHidden:YES];
appDelegate.window.rootViewController = appDelegate.tabBarController;
}
}
答案 0 :(得分:2)