Re: Getting Started
Re: Getting Started
- Subject: Re: Getting Started
- From: Stéphane Sudre <email@hidden>
- Date: Fri, 6 Jul 2001 13:38:57 +0200
On vendredi, juillet 6, 2001, at 01:28 PM, Tony Belding wrote:
I'm just starting to learn my way around Objective-C and Cocoa here.
I'm at that awkward point where bits and pieces make sense, but I have
trouble putting them together to make a program that works and does
something. I hope someone can give me a bit of nudge. . . Right now,
just as an exercise, I'm trying to open a window and do some drawing in
it.
I figured out how to use awakeFromNib: to execute some code after my
window opens, but I don't know how to get the id of my window. The
currency converter tutorial had a line like this:
[[rateField window] makeKeyAndOrderFront:self];
But I don't have a "rateField" gadget in my window. I don't have any
gadgets there, I just have an empty window that I want to do some
drawing in.
I am curious about these IB attributes for my window, where it says,
Backing: Nonretained / Retained / Buffered. It seems like Buffered is
the only option that gives me a normal-looking Aqua window. What are
the others intended for?
Finally . . . Once I get these little puzzles solved, I'll have to
think about some commands to actually draw in the window. I assume
Quartz is the way to go for that. Can anyone point me toward example
code using Quartz?
One possible solution:
You create a subclass of NSView and you overload the drawRect: method to
do your drawing stuff (using either Cocoa (easiest) or CoreGraphics
(harder since the doc are the headers)).
Then in your nib, you add a custom view to your window, and your set the
class of this custom view (Command + 5) to be the one of your NSView
subclass.