这是代表。
@protocol DropControllerDelegate;
@interface DropController : NSObject
id<DropControllerDelegate> delegate;
}
@property (nonatomic, assign) id<DropControllerDelegate> delegate;
+ (DropController*) sharedController;
@protocol DropControllerDelegate <NSObject>
- (void)openUserButtons;
- (void)startUpload;
- (void)uploadDone;
- (void)uploadFailed;
- (void)startDownload;
- (void)downloadDone;
- (void)subFolderLoaded;
@end
这是单一州法典:
static DropController *sharedCont = nil;
#pragma mark Singleton stuff
+ (DropController *) sharedController {
@synchronized(self) {
if (!sharedCont)
sharedCont = [[DropController alloc] init];
return sharedCont;
}
return sharedCont;
}
The code to set the delegate is (in both myControllerA and myControllerB):
DropController* dropHelper = [DropController sharedController];
dropHelper.delegate = self;
我能够接受一名控制员的电话,但不能在另一名控制员身上(这部法律是一张影印机),这正促使我cra!