iOS設置導航與其標題的顏色及字體大小和系統默認TabBar的相關設置與使用方法


第一步:

//在info.plist中添加一個字段:view controller -base status bar 設置為NO;
//導航顏色
[[UINavigationBar appearance] setBarTintColor:[UIColor XXXX]];
[[UITableViewCell appearance] setBackgroundColor:[UIColor XXXX]];

//設置狀態欄(信號區)白色
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

//默認帶有一定透明效果,可以使用以下方法去除系統效果
[navigationController.navigationBar setTranslucent:NO];

//更改導航標題字體大小與顏色要在第一級頁面設置 如下
// 設置導航默認標題的顏色及字體大小
self.navigationController.navigationBar.titleTextAttributes = @{UITextAttributeTextColor: [UIColor whiteColor], UITextAttributeFont:[UIFont boldSystemFontOfSize:18]};

 

 

第二步:

//UIImageRenderingModeAlwaysOriginal 讓圖片表現的模式為圖片的原始樣式 用於去掉系統添加的顏色
if ([[UIDevice currentDevice] systemVersion].floatValue >= 8.0) {
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"title" image:[[UIImage imageNamed:@"Image.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] selectedImage:[[UIImage imageNamed:@"ImageS.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

}else{

self.tabBarController.tabBarItem.title = @"title";
if ([[UIDevice currentDevice] systemVersion].floatValue >= 7.0) {

[self.tabBarController.tabBarItem setFinishedSelectedImage:[[UIImage imageNamed:@"Image.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] withFinishedUnselectedImage:[[UIImage imageNamed:@"ImageS.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
}else{
[self.tabBarController.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"Image.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ImageS.png"]];
}
}
//tabbar顏色 用於更改字體顏色
[self.tabBarController.tabBar setTintColor:[UIColor XXXX]];


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM