标签:
通常我们设置标签控制器时,给标签控制器上添加选中图片和未选中图片,但是一般情况下都有渲染颜色 ,想要彻底换成我们想要的图片的效果,需要进行设置
//设置被选中和为被选中的图片
+ (UITabBarItem *)tabbarItemWithTitle:(NSString *)title image:(UIImage *)image selectedImage:(UIImage *)selectedImage {
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
selectedImage = [selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
return [[UITabBarItem alloc] initWithTitle:title image:image selectedImage:selectedImage];
}
导航控制器的颜色问题
1//导航控制器的背景颜色
self.navigationController.navigationBar.barTintColor = [UIColor redColor];
2//导航控制器的渲染颜色 -- 底色
self.navigationController.navigationBar.tintColor = [UIColor yellowColor];
3//给导航条上添加按钮时,是给viewController添加,而不是给navigationController上添加
UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleAdd:)];
self.navigationItem.rightBarButtonItem = rightItem;
4//给导航栏标题更改字体
//6.设置导航条标题文字的大小和颜色
NSDictionary *dic = @{
NSFontAttributeName:[UIFont boldSystemFontOfSize:18],
NSForegroundColorAttributeName:[UIColor whiteColor]
};
self.navigationController.navigationBar.titleTextAttributes = dic;
设置状态条 -- 修改为白色
UIStatusBarStyleLightContent
View controller-based status bar appearance 给yes
5//控制器和状态栏的高度问题
NSLog(@"%f", [UIApplication sharedApplication].statusBarFrame.size.height); --20
NSLog(@"%f", [[[UINavigationController alloc] init] autorelease].navigationBar.frame.size.height); -- 44
NSLog(@"%f", [[[UITabBarController alloc] init] autorelease].tabBar.frame.size.height); -- 49
标签:
原文地址:http://www.cnblogs.com/DravenL/p/4585887.html