objective-c之委托
来源:互联网 发布:短信数据恢复软件 编辑:程序博客网 时间:2024/04/30 12:19
#import <Foundation/Foundation.h>@protocol PrintProtocolDelegate- (void)processCompleted;@end@interface PrintClass :NSObject{ id delegate;}- (void) printDetails;- (void) setDelegate:(id)newDelegate;@end@implementation PrintClass- (void)printDetails{ NSLog(@"Printing Details");//5 [delegate processCompleted];//6}- (void) setDelegate:(id)newDelegate{ delegate = newDelegate;//3}@end@interface SampleClass:NSObject<PrintProtocolDelegate>- (void)startAction;@end@implementation SampleClass- (void)startAction{ PrintClass *printClass = [[PrintClass alloc]init];//2 [printClass setDelegate:self]; [printClass printDetails];//4}-(void)processCompleted{ NSLog(@"Printing Process Completed");//7}@end//委托的实现int main(int argc, const char * argv[]){ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; SampleClass *sampleClass = [[SampleClass alloc]init]; [sampleClass startAction];//1 [pool drain]; return 0;}
0 0
- objective-c之委托
- Objective-C学习之路 委托模式
- objective-c之委托协议详细讲解
- Objective-C学习之路 委托模式
- Objective-c委托
- Objective-C 委托模式
- Objective-c中的委托
- Objective-C中的委托
- Objective-c中的委托
- Objective-c中的委托 .
- objective-c协议 委托
- Objective-C中的委托
- Objective - C 委托/协议
- objective-c 协议和委托
- objective-c 协议和委托
- objective-c 协议和委托
- Objective-c 协议与委托
- objective-c 委托与协议
- [置顶]【H3 BPM工作流程产品小故事】第七篇 公式计算
- Activity应用程序组件
- 常用的一些小知识点 html、jsp、css、js、java、tomcat、mysql 等
- poj 1797 并查集 / floyd(超时)
- matlab基础笔记(二)mat文件与m文件的区别及应用
- objective-c之委托
- Maven入门指南⑦:Maven的生命周期和插件
- Android studio 导入HTML文件
- [分享] 用NodeJs做一个小爬虫,附源码!
- Golang 1.7.3 Context 简单用法.类似sync.WaitGroup
- Ubuntu 14.04 不能使用 MTK Flash Tools 问题解决方法
- 图片压缩的三种方法?
- POJ 2051 Argus(堆排序 or STL优先队列)
- 算法竞赛与入门经典 (第一章)