"iOS dev-uitabbarcontroller" Uitabbarcontroller settings on the uinavigationcontroller above

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.