Some things about the iOS system navigation bar and the custom navigation bar

Source: Internet
Author: User

  1. About the system navigation bar is really let people love and hate, Love is Apple itself to the package of this control is very perfect, including memory, landscaping, gradient animation and so on, generally speaking, basically all the requirements can be met. But you need to know what is going to happen in China, and it will change, for example, data concurrency in the background. In the domestic wonderful product design, navigation bar is beyond recognition, anyway, I saw the more famous app, found that their navigation bar is basically a custom, which involves the biggest problem is the navigation bar itself hidden, color gradient.
  2. In fact, when running through the app, you can see the layering of the system Navigationbar. A navigationbar is a lot of layers, not the outermost layer we see, it has the control of color layers, there are navigationitem layers to place controls, and so on, interested can be through Xcode debug Navigator--->view UI Hierarchy, similar to the Reveal tool.
  3. The system's navigation bar is not much to say, because when you use the custom navigation bar, basically is your product demand, the system navigation bar has not satisfied, or said satisfies extremely troublesome. I also encountered a period of time such a tangled product demand, home navigation bar hidden, some hidden behind the interface, some do not hide, then in order to prevent push/pop sliding animation when the navigation bar produced black bar, need to make a series of settings, extremely troublesome. As for why, in this explanation, because when you set the Navigationcontroller, there is always only one navigationcontroller in this stack. At the same time, Navigationbar is always only one, but why the navigation bar of each interface can be placed in different controls? That's because the navigationitem of the placement control is initialized for each interface, praising the ingenuity of the Apple engineer again, but this leads to a problem where the life cycle of the different interfaces will converge in Viewwillappear and Viewwilldisappear, Then the system's Navigationbar will be affected. This is why when you set up different controls, the system Navigationbar looks normal, but the transparency and color of your navigationbar will come up with various problems.
  4. For the reasons above, I have customized Navigationbar and Navigationitem. At first, I placed the custom Navibar and Naviitem in the Uinavigationcontroller category, and later I discovered that because the navigationcontroller of the system was initialized only once in a stack, This causes the Navibar of the interface after each push to overwrite the previous interface, resulting in the inability to manipulate the navibar of the previous interface after the return, and I think the sex system may have been recorded in some way, but I'm not sure yet. So I can only go back and then put it in the Uiviewcontroller category, which is a perfect solution to these problems.
  5. Item Https://github.com/jizhidejingmo/YYNavigationBar

Some things about the iOS system navigation bar and the custom navigation bar

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.