Clearing "may not respond" warnings for UIView and UIViewController
- by user284681
In an iPad app, I'm using a custom subclass of UIView with UIViewController. Here's the view header:
@interface pdfView : UIView {
CGPDFDocumentRef doc;
}
-(void)setDoc:(CGPDFDocumentRef)newDoc;
@end
And here's the controller header:
@interface iPadPDFTestViewController : UIViewController {
CGPDFDocumentRef doc;
}
- (void)loadPDF;
@end
Part of the controller implementation:
- (void)viewDidLoad {
[super viewDidLoad];
[self loadPDF];
[self.view setDoc:doc];
}
In Interface Builder, I've set the view object to use the class pdfView.
At compilation, [self.view setDoc:doc]; gives the warning "'UIView' may not respond to '--setDoc'." I'm guessing that this warning appears because the compiler thinks it's looking at UIView (which does not implement the setDoc method) instead of pdfView. But why does it think that? And how can I tell it what class it's really looking at, so as to clear the warning?