How many times will a sub-classed NSView be instantiated in a simple Cocoa App?
How many times will a sub-classed NSView be instantiated in a simple Cocoa App?
- Subject: How many times will a sub-classed NSView be instantiated in a simple Cocoa App?
- From: Graham Reitz <email@hidden>
- Date: Sat, 24 May 2008 18:43:04 -0500
(fyi) I am coming from the non Mac C++ land and I am trying to grok
Obj-C and the Cocoa framework.
1) Create a simple Cocoa application
2) Open IB and drag a Custom View over to the Window
3) Drag an Object to MainMenu.nib
4) Name the Custom View and Object to the same class name
5) Write the class files and add them to the project
6) Derive the class from NSView and implement the initWithFrame method.
7) Run the program in debug mode.
initWithFrame is called twice (self equals something different each
call).
-Where is the other derived NSView object getting instantiated and
what is it?
-Is 'self' the same as 'this'? It doesn't seem like the same since
super is the parent class.
-How can I tell if the sub-classed NSView instance is from the Custom
View that was dragged over in IB? I did notice that one of the height/
width from the NSRect object pass has values the size of the window
and the other is 0,0.
Any guidance, clarification and etc. will be greatly appreciated.
thanks,
graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden