NSMutableArray * dataArray = [[NSMutableArray alloc] init];
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main"
bundle:nil];
BasicIn *viewController1=[storyboard instantiateViewControllerWithIdentifier:@"BasicInfo"];
viewController1.tabBarItem.image=[UIImage imageNamed:@"contactTab.png"];
viewController1.tabBarItem.title=@"Basic Info";
[dataArray addObject: viewController1];
UIStoryboard *storyboard1=[UIStoryboard storyboardWithName:@"Main"
bundle:nil];
AddImageVC *viewController2=[storyboard1 instantiateViewControllerWithIdentifier:@"AddImageVC"];
viewController2.tabBarItem.image=[UIImage imageNamed:@"planTab.png"];
viewController2.tabBarItem.title=@"Images";
[dataArray addObject:viewController2];
UITabBarController *myTabBarController = [[UITabBarController alloc] init];
self.myTabBarController.viewControllers =dataArray;
[self.view addSubview:[self.myTabBarController view]];
UIColor *appTintColor=[UIColor colorWithRed:19.0/255 green:89.0/255 blue:234.0/255 alpha:1.0];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont
fontWithName:@"HelveticaNeue-Bold" size:10.0f],
NSForegroundColorAttributeName : appTintColor
}forState:UIControlStateSelected];
Now It`s created a normal tab bar function.you can create dynamic tabs in tab bar controller with this code, without using any 3 party framework.
不,UITabBarController
不能做可滚动的标签栏。它只能处理1-5个条形按钮,之后您将获得一个更多按钮作为访问其他按钮的最后一个元素。
文件说:
如果向选项卡栏控制器添加六个或更多自定义视图控制器,则选项卡栏控制器仅显示前四个项目以及选项卡栏上的标准更多项目。
Read more about UITabBarController here
也就是说,您可以随时添加自己的自定义UI组件来完成工作。根据您的具体要求,可能不会那么困难。