iOS_Apprentice_2_Checklists学习总结(4)
2014-11-08 20:35
106 查看
Delegates in five easy steps
In review, these are the steps for setting up the delegate pattern between two
objects, where object A is the delegate for object B, and object B will send out
the messages:
1. Define a delegate
protocol for object B.
2. Give object B an optional
delegate variable. This variable should be
weak.
3. Make object B send messages to its delegate when something interesting
happens, such as the user pressing the Cancel or Done buttons, or when it
needs a piece of information.
4. Make object A conform to the delegate protocol. It should put the name of
the protocol in its
class line and implement the methods from the protocol.
5. Tell object B that object A is now its delegate.
In review, these are the steps for setting up the delegate pattern between two
objects, where object A is the delegate for object B, and object B will send out
the messages:
1. Define a delegate
protocol for object B.
2. Give object B an optional
delegate variable. This variable should be
weak.
3. Make object B send messages to its delegate when something interesting
happens, such as the user pressing the Cancel or Done buttons, or when it
needs a piece of information.
4. Make object A conform to the delegate protocol. It should put the name of
the protocol in its
class line and implement the methods from the protocol.
5. Tell object B that object A is now its delegate.
相关文章推荐
- iOS_Apprentice_2_Checklists学习总结(3) protocol解释
- iOS_Apprentice_2_Checklists学习总结(1)
- iOS_Apprentice_2_Checklists学习总结(5)建立存储数据用的路径
- iOS Apprentice Second Edition 第2版ios7 史诗级iOS教程+源码
- Swift(iOS_Apprentice)学习笔记
- The iOS Apprentice:Getting Started
- Basic FortiOS 2.80 OSPF configuration
- FortiOS v3.0 HA Cluster virtual MAC addresses
- Using the FortiOS built-in packet sniffer
- 交换机IOS升级实例及相关文件命令
- Limiting YouTube bandwidth for fortios 3.0
- Configuring Secure Shell on Cisco IOS Routers
- 解析思科IOS操作顺序
- 浅谈 unix, linux, ios, android 区别和联系
- IOS恢复备份使用帮助
- ccna最新真题(2)Basic IOS Configuration