Clearing "may not respond" warnings for UIView and UIViewController
Posted
by user284681
on Stack Overflow
See other posts from Stack Overflow
or by user284681
Published on 2010-04-09T15:51:44Z
Indexed on
2010/04/09
15:53 UTC
Read the original article
Hit count: 391
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?
© Stack Overflow or respective owner