#import "LYTabBarController.h"
#import "LYNewsViewController.h"
#import "LYReadingViewController.h"
#import "LYAudioVisualViewController.h"
#import "LYTopicViewController.h"
#import "LYMeViewController.h"
@interface LYTabBarController ()
@end
@implementation LYTabBarController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor lightGrayColor];
NSArray *titles = @[@"新聞", @"閱讀", @"視聽", @"話題", @"我"];
NSArray *vcNames = @[@"LYNewsViewController", @"LYReadingViewController", @"LYAudioVisualViewController", @"LYTopicViewController", @"LYMeViewController"];
NSMutableArray *navCs = [NSMutableArray array];
for (NSInteger i = 0; i < 5; i ++) {
UIViewController *vc = [[NSClassFromString(vcNames[i]) alloc] init];
vc.title = titles[i];
UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:vc];
[navCs addObject:navC];
// 圖片渲染
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:titles[i] image:[[UIImage imageNamed:[NSString stringWithFormat:@"anchor%ld", (long)i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:[NSString stringWithFormat:@"anchor%ld", (long)(i + 5)]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
navC.tabBarItem = item;
}
self.tabBar.barTintColor = [UIColor grayColor];
self.tabBar.tintColor = [UIColor grayColor];
self.viewControllers = navCs;
}
@end
tabBar&圖片渲染
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
推薦閱讀更多精彩內(nèi)容
- 方式二在 Assets.xcassets文件夾中更改 改變之后不用代碼 并且在所有的控制器里面都會(huì)被作用到具體操作
- 在使用tabBarViewController的時(shí)候,會(huì)遇到在tabBar中顯示的圖片和顏色被渲染成為藍(lán)色的問題。...
- Android 自定義View的各種姿勢(shì)1 Activity的顯示之ViewRootImpl詳解 Activity...
- 作者:周天鶴 流金的歲月,似水的年華,當(dāng)童年隨著時(shí)間的流逝,慢慢淡出我們世界的時(shí)候才發(fā)現(xiàn),原來(lái),童年是那樣...