• 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
[Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures


  • Subject: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
  • From: Dale Gillard <email@hidden>
  • Date: Sun, 8 Jul 2001 22:37:03 +1000

Hi all

I have 2 questions from the Learning Cocoa book I'm hoping people can help me with:

QUESTION 1
Page 127 shows figure 8-3. It depicts the view hierarchy of a window with 3 views: A, B and C. A is the window view containing views B and C. What I don't understand is that the hierarchy has 2 NSWindows sitting between the NSApplication and NSView 'A'. Shouldn't there only be 1 NSWindow?

QUESTION 2
OK. My second question relates to the Dot View project on pages 133 - 138. Page 135 contains example 8-1. It's code declaring a header file for DotView, including these 2 variables:
NSPoint center;
NSColor *color;

My question is: why is one a variable, and the other a pointer to a variable? Is this because the NSPoint class always returns an object of NSPoint when it's created? And that the NSColor class returns a pointer to a NSColour object when it is instantiated?

I've had a look in the Cocoa Help but can't find any info for NSPoint (Objective C version). (There is a Java version of the help info in Cocoa Help.) I've also had a look for and found the NSColor Cocoa Help info. But I can't find where is says what is returned when an object of this type is instantiated. That is, whether it's a pointer or a variable.

Am I missing something in the help documentation? Am I missingn something in my knowledge of C (I've done some C++ at university). If not, how do others know whether to declare a variable or a pointer to a variable?

Many thanks for any help
Dale


  • Follow-Ups:
    • Re: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
      • From: naden <email@hidden>
    • Re: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
      • From: Chris Gehlker <email@hidden>
    • Re: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
      • From: Finlay Dobbie <email@hidden>
  • Prev by Date: Re: rapp events
  • Next by Date: Re: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
  • Previous by thread: Re: Cocoa and desktop image
  • Next by thread: Re: [Learning Cocoa Qs] View Hierarchy & Pointers to Cocoa data structures
  • Index(es):
    • Date
    • Thread