@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