【iOS開發】iOS7 兼容及navigationbar的細節操做

 

1:statusBar字體爲白色ios

在plist裏面設置View controller-based status bar appearance 爲 NO;設置statusBarStyle 爲 UIStatusBarStyleLightContent
app

2:設置statusBar和navigationbar爲一體字體

 

[nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg_navbar.png"] forBarPosition:UIBarPositionTopAttached barMetrics:UIBarMetricsDefault];

 

 

3:tabBarItem被選中沒效果,須要調用sdk7中的方法:spa

 

//兼容ios7之前
[viewController.tabBarItem setFinishedSelectedImage:actionMenu.selectedIcon withFinishedUnselectedImage:actionMenu.icon];
//ios7的方法
viewController.tabBarItem.selectedImage = actionMenu.selectedIcon;

 

4:刷新狀態欄statusBarcode

 

[self setNeedsStatusBarAppearanceUpdate]

5:navigationbar上面的BarButtonItem字看不見問題,backBarItem箭頭沒有,則須要
it

 

//ios7設置BarButtonItem字體顏色,則會顯示出來,不包括返回箭頭
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, 0) forBarMetrics:UIBarMetricsDefault];
//設置BarButtonItem顏色,包括返回箭頭
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

 

6:取消ios7自帶手勢,好比navigationcontroller的右滑返回io

 

self.navigationController.interactivePopGestureRecognizer.enabled = NO ;
相關文章
相關標籤/搜索