IOS: common attributes of UINavigationController

Source: Internet
Author: User

IOS: common attributes of UINavigationController

// Push from the current view to the target view. If the view already exists, the stack [self. navigationController pushViewController: commentListVC animated: YES]; // returns the previous controller [self. navigationController popViewControllerAnimated: YES]; // returns a controller [self. navigationController popToViewController: [[UIViewController alloc] init] animated: YES]; // return to the root view [self. navigationController popToRootViewControllerAnimated: YES]; // After B pop returns A, whether B is released depends on whether the subsequent Code uses B again. If the subsequent code still uses B, the memory occupied by B is retained. In one case, if the memory is extremely insufficient, IOS may release B according to certain policies, B is re-created when it is used again. In addition, even if B is no longer used in the code after pop, B's memory may only be released, and the release time is not certain, this depends on the recycle policy of the garbage collector. // remove the text of the return button to display self. navigationItem. backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle: @ "" style: Custom target: nil action: NULL]; // custom left/right navigation Item 1 UIButton * btn1 = [UIButton buttonWithType: upload]; UIButton * btn2 = [UIButton buttonWithType: Upload]; UIBarButtonItem * bar1 = [[UIBarButtonItem alloc] handler: btn1]; handler * bar2 = [[Alibaba alloc] handler: btn2]; // left and right navigation items in the navigation bar. You can customize buttonself. navigationItem. leftBarButtonItem = bar1; self. navigationItem. rightBarButtonItem = bar1; // you can add multiple entries, followed by an array. The order of the entries is self. navigationItem. leftBarButtonItems = @ [bar1, bar2]; self. navigationItem. rightBarButtonItems = @ [bar1, bar2]; // custom left and right navigation Item 2 viewController. navigationItem. rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage: [UIImage imageNamed: @ "navItem_course"] style: adjust target: self action: @ selector (showCourse :)]; viewController. navigationItem. leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle: @ "" style: UIBarButtonItemStylePlain target: self action: @ selector (logOut :)]; // set the title view of the navigation bar, you can customize a view and a label. navigationItem. titleView // The back button background is white [self. navigationBar setTintColor: [UIColor whiteColor]; [self. navigationBar setTitleTextAttributes: [NSDictionary attributes: COLOR_WITH_RGB (230,230,230), UITextAttributeTextColor, [UIFont boldSystemFontOfSize: 18366f], fingerprint, nil]; // set the navigation bar color [self. navigationBar labels: [UIImage imageWithColor: COLOR_WITH_RGB (70, 70, 70) size: CGSizeMake (SCREEN_WIDTH, KNav_Height)] forBarMetrics: UIBarMetricsDefault]; // hide navigationBarself. navigationController. navigationBarHidden = YES;

Related Article

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.