#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&图片渲染

March_CullenIP属地: 江苏
字数 0
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
1人点赞

March_Cullenstep by step
总资产246共写了2.5W字获得105个赞共15个粉丝
推荐阅读更多精彩内容
- 方式二在 Assets.xcassets文件夹中更改 改变之后不用代码 并且在所有的控制器里面都会被作用到具体操作
- Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...