最近又刚刚翻过头来写iPhone的代码
原来使用Xcode2版本,现在都4了
安装完Xcode4新建工程,我晕了.....(不解释了)
现在作为菜鸟,从头记笔记,先看看用处最多的delegate代理
首先是声明定义部分:
CContentViewController.h文件
@class CContentViewController;
@protocol CsContentViewDelegate
@required //必需要实现的方法
- (void)CContentViewControllerDidFinish:(CContentViewController *)controller;
@end
@interface CContentViewController : UIViewController
{
//成员变量
}
@property (assign, nonatomic) id CContentViewDelegate delegate;
- (IBAction)back:(id)sender;
@end
CContentViewController.m文件
- (IBAction)back:(id)sender {
//[self dismissModalViewControllerAnimated:YES];
[self.delegate ChatsContentViewControllerDidFinish:self];
}
<