ios developer tiny share-20160926
来源:互联网 发布:开发类似唯品会软件 编辑:程序博客网 时间:2024/06/14 04:59
本节开始,我们将讲Objective-C的面向接口编程,先看下本章的OverView。
Working with Protocols
In the real world, people on official business are often required to follow strict procedures when dealing with certain situations. Law enforcement officials, for example, are required to “follow protocol” when making enquiries or collecting evidence.
In the world of object-oriented programming, it’s important to be able to define a set of behavior that is expected of an object in a given situation. As an example, a table view expects to be able to communicate with a data source object in order to find out what it is required to display. This means that the data source must respond to a specific set of messages that the table view might send.
The data source could be an instance of any class, such as a view controller (a subclass of NSViewController on OS X or UIViewController on iOS) or a dedicated data source class that perhaps just inherits from NSObject. In order for the table view to know whether an object is suitable as a data source, it’s important to be able to declare that the object implements the necessary methods.
Objective-C allows you to define protocols, which declare the methods expected to be used for a particular situation. This chapter describes the syntax to define a formal protocol, and explains how to mark a class interface asconforming to a protocol, which means that the class must implement the required methods.
- ios developer tiny share-20160926
- ios developer tiny share-20160628
- ios developer tiny share-20160629
- ios developer tiny share-20160630
- ios developer tiny share-20160701
- ios developer tiny share-20160704
- ios developer tiny share-20160705
- ios developer tiny share-20160706
- ios developer tiny share-20160707
- ios developer tiny share-20160708
- ios developer tiny share-20160711
- ios developer tiny share-20160712
- ios developer tiny share-20160713
- ios developer tiny share-20160714
- ios developer tiny share-20160715
- ios developer tiny share-20160718
- ios developer tiny share-20160719
- ios developer tiny share-20160720
- memcache集群服务:memagent配置使用
- SAP PM概念学习
- 如何查看自己运行ubuntu是32位还是64位
- 天才住在我家隔壁
- java 程序的初始化顺序是怎样的?
- ios developer tiny share-20160926
- Codevs1082 线段树练习 3 Lazy
- Velocity教程
- 安装VMware虚拟机及在虚拟机上安装Linux系统(Ubuntu)
- 【bzoj1218】 [HNOI2003]激光炸弹
- Symfony2学习视频地址
- ajax无刷新下载文件 虚拟form
- 风应该是凉的
- SAP中内部订单和PS的区别