Agent Agreement

Design Patterns:

Why Design Patterns: help us to quickly develop robust procedures (to solve a practical problem)

Protocl agreement: the equivalent Java interface provides a set of methods which do not need to realize who is who obey achieve

If you need to use a protocol provided, this method requires the use of the class to subject to an agreement <> subject to an agreement may be subject to a plurality of protocols <a, b>

Statement protocol method:

Class subject to an agreement:

Acting achieve renting:

Acting for data correction:

1. Define a set of protocol

2. Define a variable property record objects subject to an agreement

3. To achieve the function returns data

 

Caller:

1. subject to an agreement

3. Create a proxy object settings

2. To achieve agreement in the method

 

delegate the problems:

1. @ class before the class to declare a specific use .h where this class need to import the header file .m

    When must use @class, the two classes A, B, header files, A is introduced into the introduction BB A, cause a circular reference

 

2. Import protocol to use import

When the import agreement, if @class only affirm this class, but can not know this class which in the end what, if required for specific content type which you must use import

 

3. nil operation will not be executed without error, so be sure to remember to set the proxy

If an object is then immediately release the object assignment to nil

 

4. assign a delegate property variables modified

Not strong to prevent circular references in some cases may be strong but not a copy 

 

Agent configuration data:

 

Guess you like

Origin www.cnblogs.com/kinghyt/p/11265400.html