讓我們看看你們是否可以在這裏找到錯誤...因爲我現在真的被卡住了。簡單的自定義代理沒有被調用
DBManager.h
@protocol DBManagerDelegate <NSObject>
@optional
- (void) managerDidFinishUpdating:(id)controller;
@end
@interface DBManager : NSObject
@property (strong, nonatomic) id <DBManagerDelegate> delegate;
- (id) init;
@end
DBManager.m
#import "DBManager.h"
@implementation DBManager
- (id)init {
self = [super init];
if (self) {
[[self delegate] managerDidFinishUpdating:self];
}
return self;
}
UIViewController.h
#import <UIKit/UIKit.h>
#import "DBManager.h"
@interface DBViewController : UIViewController <DBManagerDelegate>
@property (nonatomic, retain) DBManager *manager;
@end
UIViewController.m
#import "DBViewController.h"
@implementation DBViewController
- (void)viewDidLoad
{
[super viewDidLoad];
_manager = [[DBMataroManager alloc] init];
[_manager setDelegate:self];
}
- (void)managerDidFinishUpdating:(id)controller {
NSLog(@"Manager did finish");
}
@end