Performance Optimization-choose nib or storyboard

Source: Internet
Author: User

The story board is a technology launched by Apple after ios5. It is designed to integrate multiple nib files into one story board file for easy management. The story board can also reflect the navigation relationship between controllers, A lot of navigation services can be connected without writing.Code. However, I warn readers that the story board is not a good technique from the perspective of memory usage.

In order to compare the data we created using the master-Detail template in xcode, The storyboarddemo and NIB-based nibdemo applications are based on the story board. Then, use the allocations template of the instruments tool to analyze the differences in memory usage when the viewcontroller View Controller is loaded. The allocations template tracking of the nibdemo project and the allocations template tracking of the storyboarddemo project.

 

The screen starts at. 776.562 milliseconds, and the memory usage is 1.10 MB. The screen starts at. 911.718 milliseconds, and the memory usage is 1.11 MB. Nibdemo has a shorter start time than storyboarddemo. The memory usage is 0.01 MB, that is, approximately 10 KB.

By default, there is a storyboard file in the project, which integrates almost all controllers in the application. As the business complexity increases, the IB design screen on the storyboard will become messy, the storyboard file will become very huge. ApplicationProgramWhen loading the storyboard, the memory usage increases.

In fact, NiB is still a good technique, but it cannot express the navigation Relationship Between pictures. You need to write code manually for screen navigation.

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.