IOS開發 ios7適配

 

  ios7控制器試圖默認爲全屏顯示,導航欄的不一樣設置會產生不一樣的效果.ios

  首先判斷系統的的版本,區別:字體

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)

官方推薦的版本判斷
NSUInteger DeviceSystemMajorVersion();
  NSUInteger DeviceSystemMajorVersion() {
     static NSUInteger _deviceSystemMajorVersion = -1;
         static dispatch_once_t onceToken;
     dispatch_once(&onceToken, ^{
         _deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion]
  componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
});
     return _deviceSystemMajorVersion;
  }
  #define MY_MACRO_NAME (DeviceSystemMajorVersion() < 7)


導航欄的顏色設置新增屬性爲barTintColor

具體寫法:
  if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
        self.navigationController.navigationBar.tintColor = [UIColor brownColor];
    } else {
        self.navigationController.navigationBar.barTintColor = [UIColor brownColor];
    }

  導航欄的屬性:tintColor用於設置控件顏色ui

  導航欄的背景圖片不一樣的size會顯示不一樣的效果.spa

  導航欄中設置空間的image對象都須要進行渲染設置,默認是渲染爲末模板,須要渲染爲原圖才能顯示.code

  bar的樣式      barStylecomponent

  bar的透明度     translucent對象

  bar的顏色    barTintColor圖片

  bar上控件的顏色 tintColorstring

  bar的背景圖片  backgroundImageit

 

  字體: 

  經過 UIFont 中的  屬性回去當前系統的字體,確保內容在不一樣字體下都能很好顯示。preferredFontForTextStyle

 

  Bars 和 Bar Buttons

  status bar 默認是透明的,其餘 bar 都是半透明的,一個通用原則:確保內容填充 Bar 下面的區域。

  navigationBar 在 UIBarPositionTopAttached 模式下會與 status bar 融合的,因此若是使用圖片須要用 128px((20 + 44) x 2)。

 

  經過設置控制器的edgesForExtendedLayout 爲uirectedgesnone也能夠將控制器視圖從導航欄下顯示,這個屬性是iOS7新增的;

 

  UITableView

  Grouped table 沒有邊距了,TableView 上的圖標(如:Checkmark,Disclosure indicator,Delete button 等)都變了。

 

  轉載請註明出處!!!  

相關文章
相關標籤/搜索