当前位置:网站首页>Encapsulation of tabbarcontroller
Encapsulation of tabbarcontroller
2022-07-26 09:49:00 【~ light boat ~】
First, create a class that inherits from UITabBarController
.m Implementation code in :
- (void)viewDidLoad {
[super viewDidLoad];
ViewController *firstVc = [[ViewController alloc] init];
[self addChildVc:firstVc title:@" Hello " image:@"mengmeng" selectedImage:@""];
SecondViewController *secondVc = [[SecondViewController alloc] init];
[self addChildVc:secondVc title:@"hello" image:@"jiyi" selectedImage:@""];
}
- (void)addChildVc:(UIViewController *)childVC title:(NSString *)title image:(NSString *)image selectedImage:(NSString *)selectedImage
{
childVC.title = title;// Simultaneous setting tabBar and navgationBar Words of
// Set the picture of the controller
childVC.tabBarItem.image = [UIImage imageNamed:image];
childVC.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
// Set the navigation controller
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:childVC];
// Add as sub controller
[self addChildViewController:nav];
}
stay AppDelegate in
self.window.rootViewController = [[QZTabBarController alloc] init];
That's all right.
边栏推荐
猜你喜欢
Customize permission validation in blazor
Node memory overflow and V8 garbage collection mechanism
服务器、客户端双认证(2)
matlab simulink实现模糊pid对中央空调时延温度控制系统控制
【荧光字效果】
Solve proxyerror: CONDA cannot proceed due to an error in your proxy configuration
SSG框架Gatsby访问数据库,并显示到页面上
Interview shock 68: why does TCP need three handshakes?
Keeping alive to realize MySQL automatic failover
【Datawhale】【机器学习】糖尿病遗传风险检测挑战赛
随机推荐
Network flow learning notes
Docker configuring MySQL Cluster
mfc随手笔记
图解用户登录验证流程,写得太好了!
Registration module use case writing
新公链Aptos何以拉满市场期待值?
面试突击68:为什么 TCP 需要 3 次握手?
2019 ICPC Asia Yinchuan Regional(水题题解)
Azkaban【基础知识 01】核心概念+特点+Web界面+架构+Job类型(一篇即可入门Azkaban工作流调度系统)
2021年山东省中职组“网络空间安全”B模块windows渗透(解析)
Redis sentinel mode setup under Windows
uni-app学习总结
E. Two Small Strings
R语言ggpubr包ggsummarystats函数可视化分组箱图(自定义分组颜色)并在X轴标签下方添加分组对应的统计值(样本数N、中位数median、四分位数的间距iqr、统计值的色彩和分组图色匹配
[fluorescent character effect]
Login module use case writing
Sqoop【付诸实践 02】Sqoop1最新版 全库导入 + 数据过滤 + 字段类型支持 说明及举例代码(query参数及字段类型强制转换)
新增市场竞争激烈,中国移动被迫推出限制性超低价5G套餐
js 表格自动循环滚动,鼠标移入暂停
高斯消元