Proxy implementation in iOS development, ios development proxy implementation
Proxy implementation in iOS development
The reason why I want to send this text today: When I am chatting with my colleagues today, he told me that the block provided to him in the project is sometimes hard to understand, so I try to use a proxy to write it, well, if you're tired, write a proxy demo first to prevent him from reading it later.
Today, I will not write a demo for my example. I will cut out the required fragments from the project and give them some advice.
The purpose of using proxy in the same city is to operate in one place and implement it in another place. This is a simple proxy.
First, we need to follow a protocol in the. h of your custom class.
Then define the Protocol
These are all implemented in self. h.
Then we implemented it in our own. m.
Here I call the proxy when btn is clicked. Here, everything in our class has been implemented, and then let's see how to implement it in the controller.
First, call this class.
Then follow the agreement
Call later implementation
Finally, call the proxy method.