• 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
Variables: Why one way and not another?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variables: Why one way and not another?


  • Subject: Variables: Why one way and not another?
  • From: Robert Borsuk <email@hidden>
  • Date: Sat, 1 Nov 2003 09:35:17 -0500

Hi All,
I've been combing the archives and I've found some interesting answers but nothing that nails it down for me. Maybe someone can explain. So I've been working with Cocoa / Obj. C for a couple of months now. I make my Controller by the usual subclass of NSObject, put variables in the there and every thing is fine.
Like so:

@interface MyController : NSObject
{
int myInt;
}

I write some accessors and life is good. Now I put an NSView on a window and subclass it. I try the same thing and no go. I notice that :

@interface myview : NSView
{
int myInt;
}

Doesn't work. I can move the variable out of the instance declaration area, like such:

int myInt;

@interface myview : NSView
{

}

and life is good. Why the difference? I put the View in the window using IB and assign the subclass there. Doesn't the instance remain through the life of the program or am I missing something? Any clarification will help.

Thanks
Rob


Rob Borsuk
email: email@hidden
Colourfull Creations
Web: http://www.colourfull.com
_______________________________________________
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.

  • Follow-Ups:
    • Re: Variables: Why one way and not another?
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Re: Detecting login/logout?
  • Next by Date: Capturing a view's drawings?
  • Previous by thread: RE: Mail hacking?
  • Next by thread: Re: Variables: Why one way and not another?
  • Index(es):
    • Date
    • Thread