プロトコルと委任を使用して、タブ バー コントローラーのさまざまなビューにメッセージを送信しようとしています。以下のように設定しましたが、メッセージを受信していないようです。
@class RaprTabBarViewController;
@protocol RaprTabBarViewControllerDelegate <NSObject>
@optional
- (void)initActivites:(NSArray *)activities;
@end
@interface RaprTabBarViewController : UITabBarController <RKObjectLoaderDelegate>
@property (nonatomic, weak) id <RaprTabBarViewControllerDelegate> delegated;
@end
次に、実装で
- (void)someMethodThatIsCalled:(NSArray *)objects {
NSLog(@"Delegating..");
[self.delegated initActivites:objects];
}
これで NSLog を取得できるので、メソッドは確実に呼び出されます。次に、ナビゲーション コントローラーに埋め込まれたビュー コントローラーを示します。
@interface ActivitesViewController : UITableViewController <RaprTabBarViewControllerDelegate>
@property (nonatomic, strong) NSArray *activites;
@end
そして実装
- (void)initActivites:(NSArray *)activities {
NSLog(@"Called initActivities");
self.activites = activities;
}
ビューコントローラーで NSLog を取得しないため、initActivites メソッドが呼び出されることはありません。私は何を間違っていますか?
ご協力いただきありがとうございます。