天天看點

UINavigationController詳解(四)iOS7新特性

@導航欄新不同

1.控制器視圖預設全屏顯示,導航欄的不同設定會帶來不一樣的效果

2.導航欄的顔色設定為新增屬性:barTintColor

3.導航欄的屬性:tintColor用于設定控件顔色

4.導航欄背景圖檔不同的size會展示不同的效果

5.導航欄中設定控件的image對象都需要進行渲染設定.預設是渲染為模闆,需要渲染為原圖才能顯示.預設是渲染為模闆,需要渲染為原圖才能顯示

@導航欄外觀

1.bar的樣式              barStyle

2.bar的透明度          translucent

3.bar的顔色              barTintColor

4.bar上控件的顔色  tintColor

5.bar的背景圖檔      backgroundImage

@導航欄布局

1.iOS6和iOS7中,導航欄的布局都是(0,0,320,44)

2.iOS6中,導航欄的背景視圖的布局是(0,0,320,44) 和導航欄的布局是一樣的

3.iOS7中,導航欄的背景視圖的布局是(0,-20,320,64),y軸定位到-20px,高度增加到64px,包含狀态欄和導航欄

4.通過設定控制器的 edgesForExtendedLayout 為 UIRectEdgeNone,也可以将控制器視圖從導航欄下顯示(iOS7新增的屬性)

@導航欄内容(新增)

1.傳回按鈕(Back)訓示圖像      UIImage *backIndicatorImage                                     

    self.navigationController.navigationBar setBackIndicatorImage:<#(UIImage *)#>

2.傳回按鈕(Back)遮罩圖像      UIImage *backIndicatorTransitionMaskImage          

    [self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:<#(UIImage *)#>

@UIBarButtonItem

1.初始化變化:

   ~ - (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action;

         系統提供樣式改變

   ~ - (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action;

         style設定為 UIBarButtonItemStylePlain(必須)

   ~ - (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action;

         圖像需要進行渲染,因為預設渲染是成模闆

         - (UIImage *)imageWithRenderingMode:(UIImageRenderingMode)renderingMode NS_AVAILABLE_IOS(7_0);

         typedef NS_ENUM(NSInteger, UIImageRenderingMode) {

               UIImageRenderingModeAutomatic,          // Use the default rendering mode for the context where the image is used

               UIImageRenderingModeAlwaysOriginal,     // 渲染為原始圖檔

               UIImageRenderingModeAlwaysTemplate,     // 渲染為模闆

         } NS_ENUM_AVAILABLE_IOS(7_0);