iOS Development OC Basics: Protocols in OC

Source: Internet
Author: User

1. A protocol is a way to extend a method for a class that has a source code.

2. The agreement is the life of a series of methods, which is equivalent to a list of tasks, which specifies what is to be done, but the implementation (that is, implementation) is implemented by the class that obeys the agreement. So the protocol only. h files, and you cannot define variables

3. The definition of the agreement is the beginning of the @protocol, the agreement of the name <> (the agreement to obey) is written in <>, the multiple protocols are separated by commas, and the content in the parent agreement is the same as the sub-Protocol, and ends with @end.


The following attachment is a small example of the agreement, you can deepen the understanding of the agreement, after reading must be more practice, in order to fully grasp.

This article is from the "A Mao" blog, please be sure to keep this source http://winann.blog.51cto.com/4424329/1436076

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.