@protocol SomeDelegate
- (void) didSomeAction;
@end
@interface A:ViewController {
id<SomeDelegate> delegate;
}
@property (nonatomic, retain) id<SomeDelegate> delegate;
@implementation A
@synthesize delegate;
- (void)someMethod {
[delegate didSomeAction];
}
- (void)viewDidLoad {
B *b = [[B alloc] init];
}
/*=========================*/
@interface B:NSObject<SomeDelegate> {
}
@implementation B
#pragma mark -
#pragma mark SomeDelegate methods
- (void)didSomeAction {
}
B应该发送消息给A,为什么这不起作用?客观c,代表
欢迎堆栈溢出,并请阅读[如何提问](http://stackoverflow.com/questions/how-to-ask)前问这问那... – jtbandes