• 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: 2 classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 classes


  • Subject: Re: 2 classes
  • From: Tony Cate <email@hidden>
  • Date: Thu, 01 Aug 2002 11:14:07 -0500

On 8/1/02 4:54 AM, "Chong Hiu Pun" <email@hidden> wrote:

> In my cocoa application, I have 2 classes, A & B, where A is the main class
> and B is do the calculation without UI element.
> How can I
> 1.) instantiate class B ? (do I need to implement a constructor for class B?)

1 Create the class stubs in PB.
2 Open the main nib and drag the class.h file into IB.
3 The new class should now as a subclass of NSObject, Instantiate it.
4 Create an outlet for the new class in the main class
5 Drag a connection from the main class to the new class and connect the
outlet.
6 Save and close IB
7 Finish writing the new class.

> 2.) Get the calculation result of B ( using getter method? But if I cannot
> instantiate class B, I cannot do it either)

You do not have to instantiate, IB does it for you.

[newClass doSomething];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >2 classes (From: "Chong Hiu Pun" <email@hidden>)

  • Prev by Date: Re: NSBezierPath
  • Next by Date: Re: Window transformations in Cocoa
  • Previous by thread: Re: 2 classes
  • Next by thread: Re: 2 classes
  • Index(es):
    • Date
    • Thread