背景
最近在看開(kāi)源中國(guó)的源代碼,里面有一些自己不熟悉的知識(shí),記錄下來(lái)最為總結(jié)
參考資料
oschina源碼
http://git.oschina.net/oschina/iphone-app
TintColor解析
http://blog.kingiol.com/blog/2014/01/09/ios7-day-by-day-day6-tint-color/
oschina源碼分析
//再plist文件中設(shè)置View controller-based status bar appearance 為 NO才能起效
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//導(dǎo)航條上標(biāo)題的顏色
NSDictionary *navbarTitleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
[[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes];
//導(dǎo)航條上UIBarButtonItem顏色
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
//TabBar選中圖標(biāo)的顏色,默認(rèn)是藍(lán)色
[[UITabBar appearance] setTintColor:[UIColor colorWithHex:0x15A230]];
//TabBarItem選中的顏色
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x15A230]} forState:UIControlStateSelected];
//導(dǎo)航條的背景顏色
[[UINavigationBar appearance] setBarTintColor:[UIColor navigationbarColor]];
//TabBar的背景顏色
[[UITabBar appearance] setBarTintColor:[UIColor titleBarColor]];
[UISearchBar appearance].tintColor = [UIColor redColor];
//當(dāng)某個(gè)class被包含在另外一個(gè)class內(nèi)時(shí),才修改外觀。
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setCornerRadius:14.0];
[[UITextField appearanceWhenContainedIn:[UISearchBar class], nil] setAlpha:0.6];
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor colorWithHex:0xDCDCDC];
pageControl.currentPageIndicatorTintColor = [UIColor grayColor];
[[UITextField appearance] setTintColor:[UIColor nameColor]];
[[UITextView appearance] setTintColor:[UIColor nameColor]];