[quote author=c99koder link=board=Dev;num=1101259752;start=0#10 date=11/29/04 at 00:47:51]Not to get further off topic, but have you played around with Interface Builder yet? Â*I don't know the syntax to access the objects it creates. Â*I created a new class called UpdaterClass, and I know it creates an instance of it.. but I don't know how to reference it outside of itself or another class by adding it to an outlet. Â*So I did a quick hack and made it set a global pointer to "self" when it gets created, but I'd really like to know the correct way to handle that.[/quote]
Hey, it's ok, we're like the old geezers that no one wants to tell to shove off(sorry everyone...)
My first Xcode project, before I started in on this KOSX stuff, was a GUI app to interface with OpenVPN. I use it in a road warrior configuration, which is pretty awesome when your city is covered in wi-fi hot spots.I'm still planning on releasing this thing when it's a little more done, but it does work.
You had the right idea originally on the IB objects actually. That's how you're supposed to do it. I can't remember exactly what goes as an attribute and what goes as an outlet. But you build the objects in IB and they get serialized into a NIB file. This is then loaded at runtime (or you can do it manually) and all those objects are once again instantiated in the form you froze them in. Connections are set up by the NIB loader automatically. So the key is to make sure IB knows about the classes you want to interface with. The simplest thing to do is make a Controller object as a subclass of NSObject on the Classes tab of the IB objects window and then go from there. You get an awakeFromNib message when it loads.
I recommend this tutorial in the docs... Go to Library->Cocoa on the left side of the Help->Documentation window; then Getting Started with Cocoa. There are a few good links on there about Cocoa, ObjC, etc, from a high level. Then hit the link "Developing Cocoa Objective-C Applications: A Tutorial" near the top, which has a step-by-step tutorial to follow.
I sure wish the rest of Apple's docs were as nice as these -- the farther you get from this basic "build an app" path, the worse it gets. By the time you're down to the low level docs about sound and such, you're reading Quicktime programming guides from 1998 for MacOS 9, with examples in Pascal, and which talk about resetting your A5 register after your callback that happens in an interrupt context
Bookmarks