Process methods and methods of implementation for iOS

Source: Internet
Author: User

Process methods and methods of implementation, the official does not have this statement, is a personal summary.

According to the Apple Cocoa naming rules, will table is going to perform an action, the content is to prepare the data, should table an action method before the execution of the license, the return type is Bool,did table to confirm the behavior, perform the operation and give the result.

From here, it can be understood that will is the initiator of the method should class as a process method, that is, to go through the scene, take a verification (bool), therefore, some large actions can not be executed in such a method.

Should is like a key, when the door open with the key, if it is open, verify, push the key can also open, analogy in the should to do some tricks also may not, but if the action is too large, it will cause damage to the key door can be destroyed.     This kind of action should be done by the did class, that is, the execution class method. Development example: Requirements in a deep sub-page implementation of the login function, so that bypass the original framework of the login process, but forced to implement is also feasible. After implementation, unexpected, return to the root directory, the logon state is not synchronized, to find out why: The original login is implemented in the root directory, after the successful logon, the root to perform a global initialization. The implementation of the new requirement is to forcibly stay in the deep sub-page after login. Therefore, when the root directory is returned, the login status token should be taken to perform a deferred initialization. Initialization is a big deal, so execution in a process method such as Shouldselecttabbarcontroller can occur without implementation and crashes. The workaround is to perform this initialization in the execution method, Didselectedtabbarviewcontroller. Before it can be properly resolved.

Process methods and methods of implementation for iOS

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.