In my Interface Controller view, I have the following code:
- (IBAction)showModal {
NSArray *namesArray = @[@"A", @"B", @"C"];
NSArray *contextsArray = @[self, self, self];
[self presentControllerWithNames:namesArray contexts:contextsArray];
}
What I would like to do is set the passed context as a delegate property on every page of my modal managed interface controller:
#import "ModalPageInterfaceController.h"
@interface ModalPageInterfaceController ()
@property (nonatomic, weak) id delegate;
@end
@implementation ModalPageInterfaceController
- (instancetype)initWithContext:(id)context {
self = [super initWithContext:context];
if (self) {
self.delegate = context;
}
return self;
}
@end
But I found that the context argument is zero for all but the first page when called initWithContext:, so I cannot set the delegation property for these pages. Am I doing something wrong, or is it just a WatchKit error?
source
share