牛骨文教育服务平台(让学习变的简单)

UINavigationController详解(四)iOS

@导航栏新不同

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:

2.返回按钮(Back)遮罩图像      UIImage *backIndicatorTransitionMaskImage          

    [self.navigationController.navigationBar setBackIndicatorTransitionMaskImage:

@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);