So I have a class called “DrawOnImageViewController”, which does something pretty obvious. In it’s header file, I also have a protocol “DrawOnImageDelegate” defined with a single method: “imageWithDrawingSelected:(UIImage *)image”. This class also obviously has a “delegate” property that conforms to that protocol.
Now I need to subclass this class so I can simply call that delegate method on the delegate in viewWillDisappear. I subclassed the above class and then overrode viewWillDisappear like so:
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[self.delegate imageWithDrawingSelected:self.imageView.image];
}
This method (viewWillDisappear) executes, but my delegate’s delegate method is never called.
I tried calling: [super.delegate imageWithDrawingSelected:super.imageView.image];
But that doesn’t work either….
Please help. Thanks in advance.
This was an oversight of the most obvious and common kind. I failed to set the delegate property. I’ll go hang my head in shame…
It’s presented in a popover controller, for which the delegate was set, but not the content view controller…