IOS Code Style Habits Summary 1

Source: Internet
Author: User

From the beginning of my junior year to start work, almost all are lonely development because around the development of iOS not much, in addition to learning the code of open source excellent style skills the rest is their own, so developed a lot of bad habits. Ben knows the benefits of object-oriented, but the actual development will always have a bad habit of piling code, just to solve the current problem, so Uiviewcontroller inside wrote a heap of some not, function point is realized, but did not give themselves back, often changed to lead a whole body, When the product prepares the high-Fidelity debugging UI when the headache says, "Your dynamic height is calculated, I do not know how to write together why not a sub-view of a model?"

So in 2015 for the first time Codereview I summed up the following several development programming ideas

I think this is my biggest progress since the development, has been in the "build", no one to tell you where you wrong, in fact, was put forward so many comments, I actually refused, because it is a kind of criticism.  But when I began to develop a bright light, forcing lattice also instant ascension, write high-quality code of the program is the senior IT engineer is distinguished from the removal of brick workers. Up, girl, this is the progress of history, it will be brighter.

    1. There must be a space or a carriage return on both sides when applying to the logical operator.
    2. Method name as far as possible to understand the method function
    3. The method name must start with lowercase
    4. When it comes to writing Tableviewcell, it is not easy to change the simplest elements to modify the height of the calculation, especially when the dynamic height must be a separate module cell or a cell in a separate model UIView
    5. Initializes a tableviewcell to use the multiplexing mechanism T to improve efficiency this applies to unified mode if there is a change, it will be covered if not applicable
    6. When the UI loads data, the data is ready to be prepared as early as possible
    7. The UI interface is complex to be split into several branch UI interfaces written into the view model to avoid the modification process of holding a full body
    8. Dynamically modify the UI location and size. Frame to minimize the use of this particularly time-consuming and inefficient, change of opinion is replaced by Cgrectgetmaxx Cgrectgetmaxx cgrectgetwidth cgrectgetheight
    9. Methods to modify the whole concept of the changes in the local is of little significance, such as the symptoms of the order of the basic should be sorted should not be in the case of the application of the time to sort

IOS Code Style Habits Summary 1

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.