mian.m
//
// main.m
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Button.h"
#import "ButtonListener.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
Button *btn = [[[Button alloc] init] autorelease];
ButtonListener *btnl = [[[ButtonListener alloc] init] autorelease];
btn.delegate = btnl;
[btn click];
}
return 0;
}
Button.h
//
// Button.h
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ButtonDelegate.h"
@interface Button : NSObject
@property (nonatomic) id<ButtonDelegate> delegate;
- (void) click;
@end
Button.m
//
// Button.m
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import "Button.h"
@implementation Button
- (void) click{
[_delegate onClick];
}
- (void) dealloc{
NSLog(@"Button destory!!");
}
@end
ButtonDelegate.h
//
// ButtonDelegate.h
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol ButtonDelegate <NSObject>
//必须实践得方法
@required
- (void) onClick;
//可不实线得方法
@optional
- (void) test;
- (void) test2;
@end
ButtonListener.h
//
// ButtonListener.h
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ButtonDelegate.h"
@interface ButtonListener : NSObject <ButtonDelegate>
@end
ButtonListener.m
//
// ButtonListener.m
// Protocal
//
// Created by Rayln Guan on 8/29/13.
// Copyright (c) 2013 Rayln Guan. All rights reserved.
//
#import "ButtonListener.h"
@implementation ButtonListener
- (void) onClick{
NSLog(@"button click!!");
}
- (void) dealloc{
NSLog(@"ButtonListener destory!!");
}
@end
分享到:
相关推荐
USB3.0 Protocal USB3.0协议
介绍了http协议, soap 1.1, soap 1.2协议,以及附近的MIME, DIME, MOMT等内容
1 ALCAP的完整PPT介绍 2.ALCAP在WCDMA中的应用
IP(Internet+Protocal)+地址+说明.doc
google protocal buffer 源代码,编译通过
epc uhf rfid protocal
SOAP over JMS Protocal
Dali Protocal 详细介绍。使用于灯光控制。
1-Wire ® (Protocol)Company: Dallas Semiconductor/Maxim(digitally communicate over twisted-pair cable with 1-Wire components over a 1-Wire network)
Wappush Protocal Document -Wireless Application Protocol (WAP) is a result of continuous work to define an industry wide specification for developing applications that operate over wireless ...
protocal buffer tar .version 2.5
bus protocal amba ahb apb chi pcie
protocal网关协议规范大全 cmpp,sgip,smgp,smpp,vspp等各种规范
routing protocal for Low power wireless network
FeliCa_ReaderWriter_Digital_Protocal_Requirements
用UPD协议实现广播通信VC源代码,UPD 是USER DATAGRAM PROTOCAL 的简称,是一种在网络上提供的无连接的传输协议
qq protocal for linux v1.0.2beta .pdf,介绍QQ for Linux 的协议
SWP single wire
s7plc通讯协议c#,可用于s7300与s71500西门子cpu,可用于工业