• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Novice Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Novice Questions


  • Subject: Re: Novice Questions
  • From: Fritz Anderson <email@hidden>
  • Date: Tue, 12 Jun 2007 12:48:08 -0500

On 12 Jun 2007, at 10:57 AM, Barry wrote:
I've downloaded ImageApp & am attempting to understand how it is put together.

Comment: You've chosen an ambitious place to start. It may turn out okay, but I'd have thought the Currency Converter tutorial would have been gentler, focusing more narrowly on the tools and offering fewer distractions. (After the Help > Documentation command, follow the path ADC Home > Reference Library > Guides > Tools > Xcode > Cocoa Application Tutorial .) It comes with a narrative, which would answer most of your questions.


I double-click on the ImageDoc.nib, select Classes, see that ImageDoc is bold (must mean something!).

It's not so much bold as black, indicating that the class has been added to the NIB. Standard classes that Interface Builder knows already are shown in gray.


So, Show Inspector for this Class& Attributes shows me 6 Outlets. These are the class variables (I think).

Permit me to enforce precision: They are outlets, which are _instance_ variables (class variables are a separate concept in OO programming, not directly supported by Objective-C) made specially available to Interface Builder by declaring them as IBOutlet. See the ImageDoc.h header.


If you click the other tab on that same inspector page, you'll see Actions. These are methods (declared as IBAction in ImageDoc.h) that NSControls may use on an instance of ImageDoc when they are triggered.

Question how/where can I see how a change to any of these controls (2 sliders & a popup) sends a message ?

Each control keeps an action (the name of a method to use when the control is triggered) and a target (a pointer to the object that is to execute the method). The link is made by dragging, with the control key held down, from the control to the object in the NIB (use the Instances view) that is to be the target. The inspector will display a list of actions. You choose one and click the Connect button.


Equally, if I choose Instances from ImageDoc.nib then select MyWindow I can actually see the controls. Selecting one of them & Showing Inspector->connections I see 3 outlets. Is there any way to see the relationship between formatter/menu/nextKeyView and the code itself ?

Strictly speaking, there is none. When certain actions are taken (tabbing to the next view, for instance), the code for the class to which the control belongs refers to that variable (nextKeyView) to determine what to do (transfer focus to that view, rather than any other). So far as you are concerned, nextKeyView has to do with data, not code.


You can often discover the meaning of an outlet by looking for a method of that name in the documentation for that object's class. (Be sure to follow the inheritance chain up if you don't find it immediately.) So look for -nextKeyView and -setNextKeyView: .

I can already see that Xcode is a very powerful developer tool but feel that, despite working through the tutorials I'm still missing a vital chapter somewhere.

That's common. The general experience is that you have to have an integrative, aha!, moment after reading the documentation and playing with the examples. If I had to suggest one thing to make it easier, it would be Aaron Hillegass's book "Cocoa Programming for Mac OS X."


	— F



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Novice Questions (From: "Barry" <email@hidden>)

  • Prev by Date: Re: Autoconf, universal binaries, and dependencies
  • Next by Date: Re: how to confirm a variable's value is reset?
  • Previous by thread: Novice Questions
  • Next by thread: how to confirm a variable's value is reset?
  • Index(es):
    • Date
    • Thread