Reputation: 433
First: I'm very new to cocoa development. I guess my problem is something very obvious.
I need to know the size of my WebView after loading. For that I've found the answer already, but I have a Problem. Here's the relevant piece of my code.
The App delegate:
@implementation MDAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
//set ourselves as the frame load delegate so we know when the window loads
[self.webView setFrameLoadDelegate:self];
// set the request variable, which works and then load the content into the webView
[self.webView.mainFrame loadRequest:request];
}
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)webFrame
{
NSLog(@"webView:didFinishLoadForFrame");
if([webFrame isEqual:[self.webView mainFrame]]) {
// some code ...
// and at some point I want to get the frame property of self.window
NSRect windowFrame = self.window.frame;
}
}
The window property is defined in the header file of the app delegate:
@interface MDAppDelegate : NSObject <NSApplicationDelegate>
@property (weak) IBOutlet MDTransparentWindow *window;
@property (weak) IBOutlet WebView *webView;
@end
I found the answer to (so it would seem) a very similar problem. The solution there is to #import <QuartzCore/QuartzCore.h>
and also link the framework in the Build Phases tab. I did this, but the problem remains. I also cleaned my project (as of now I still don't really know what cleaning does, but sometimes it helps) with no result.
The window is an instance of my own class TransparentWindow
which is subclassing NSWindow
. When I start writing self.f
in the subclass implementation file xcode automatically suggests frame
. But this is not happening when I write self.window.f
in the webView:didFinishLoadForFrame
method.
As I said, I'm new to cocoa development. Any hints, what I might have missed?
Upvotes: 0
Views: 483
Reputation: 52538
You usually get this message if you only did a forward declaration of a class, like
@class MyPhantasticClass;
The compiler knows that it is a class, but doesn't know any of it's methods. You need to include the right header file.
Upvotes: 2