标签控制器的简单使用
程序员文章站
2024-03-11 10:05:49
...
//下列代码为创建3个控制器分别为n1,n2,n3
UINavigationController*n1=[[UINavigationController alloc]initWithRootViewController:[[FirstViewController alloc]init]];
n1.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"111"image:nil tag:0];
UINavigationController*n2=[[UINavigationController alloc]initWithRootViewController:[[SecondViewController alloc]init]];
n2.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"222"image:nil tag:1];
UINavigationController*n3=[[UINavigationController alloc]initWithRootViewController:[[ThirdViewController alloc]init]];
n3.tabBarItem=[[UITabBarItem alloc]initWithTitle:@"333"image:nil tag:2];
//小红点
n3.tabBarItem.badgeValue[email protected]"2";
self.viewControllers[email protected][n1,n2,n3];
self.tabBarController.selectedViewController= [self.viewControllers objectAtIndex:1];
下一篇: Kubernetes Pod详解