Customizing the navigation bar
In order to ensure that the navigation bar effect of the project has always been, the general will set the navigation bar style like
① Customizing a Navigationcontroller class, inheriting and Uinavigationcontroller classes
② Change all Uitabbarcontroller the class property of the Uinavigationcontroller below is a custom class form
③ is mainly to get the navigation bar appearance object, manipulate it to set the navigation bar theme
UINavigationBar *navBar = [UINavigationBar appearance];
④ Navigation Bar Background
//设置导航栏背景的- (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics;
⑤ Setting the title
@property(nonatomicNSDictionary *titleTextAttributes;// 字典中能用到的key在UIStringDrawing.h中// 最新版本的key在UIKit框架的NSAttributedString.h中
Customize navigation bar Buttons
UIBarButtonItem *item = [UIBarButtonItem appearance];
IOS6 The plot size of the background of the navigation bar
Non-retina:320x44 px
retina:640x88 px
IOS7 The plot size of the background of the navigation bar
retina:640x128 px
Custom Navigationcontroller
To customize the navigation controller: Create a new class that inherits from Uinavigationcontroller
Value of custom navigation controllers
Rewrite the push method to intercept all the sub-controllers in the stack and do some processing
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
Override the Pop method to intercept the stack of all the sub-controllers
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
To hide Uitabbar when the push controller is in use, the following settings are required
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{ viewController.hidesBottomBarWhenPushedYES; [super pushViewController:viewController animated:animated];}
The difference between initailize and load methods
Initailize, Load are class methods
When a class is loaded into memory, the load method is called once (the class is not yet available)
When this class is first used, the Initailize method is called once
"iOS dev-uitabbarcontroller" Uitabbarcontroller settings on the uinavigationcontroller above