|
|
awakeFromNib called twice?
|
|
|
|
Mac Enthusiast
Join Date: Feb 2003
Location: Portland, Oregon
Status:
Offline
|
|
I'm writing an OpenGL program in C++, but am using Objective-C++ / Cocoa for the GUI front-end. For some reason awakeFromNib, initWithFrame:, and initGL are all being called twice. awakeFromNib is responsible for calling a C++ function within one of my C++ back-end classes which creates a list of objects.... Now does this mean that I have two instances of this list? Is it normal for these functions to be executed twice? If not, any suggestions on how to fix it? I've done a little bit of searching and it seems to be a bi-product of NSDocument based programs, but this is just subclassed OpenGLView. So the header of my one and only Objective-C++ class is:
@interface MyOpenGLView : NSOpenGLView
Appreciate any help you can give me.
Jesse Thompson
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
No, AFAIK, those methods should not be called twice unless there are two instances of the object.
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
Put an NSLog(@"%@", self) in at the beginning of your awakeFromNib method to see if it's being called on the same instance.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Feb 2003
Location: Portland, Oregon
Status:
Offline
|
|
Originally posted by Chuckit:
Put an NSLog(@"%@", self) in at the beginning of your awakeFromNib method to see if it's being called on the same instance.
I'm not sure what the output means:
2004-07-25 20:47:22.989 447Project[3010] <MyOpenGLView: 0x33c3do>
2004-07-25 20:47:23.058 447Project[3010] <MyOpenGLView: 0x344980>
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Nov 2002
Location: Rockville, MD
Status:
Offline
|
|
it means there are two different instances of your view and each one gets awakeFromNib called on it once
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
This implies that you're class is getting instantiated twice. Is it instantiated by the NIB itself? Is it also instantiated in code ( alloc, init)?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|