• 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: Very basic Bindings question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very basic Bindings question


  • Subject: Re: Very basic Bindings question
  • From: Jason Coco <email@hidden>
  • Date: Wed, 24 Sep 2008 04:44:23 -0400


On Sep 24, 2008, at 04:21 , Adil Saleem wrote:

Hi,

I am trying to use bindings for the first time. So this is a pretty basic question.

As an example what i am trying to do is that i have a NSTextField in which user enters some numeric value. I have a int type variable in my class that is binded to the value field of this text field. I get the value in the variable correctly. But the problem is that the accessor method that i have written are not called. If i print something in the accessor methods, it is not printed on the console.

Here is the code.


I have declared in myClass.h

@interface myClass: NSObject {

         int Var;
}

-(void)setVar:(int)aNumber;
-(int)getVar;

Don't use getVar (also, don't start a variable with a capital letter)... the correct naming convention is this:


@interface MyClass : NSObject { // the convention is to start class names with a capital letter
int var;
}


-(void)setVar:(int)aNumber; // the setter message should be the word set + [capital first letter] + rest of variable name
-(int)var; // the getter message should have the same name as the variable


HTH, Jason

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Very basic Bindings question (From: Adil Saleem <email@hidden>)

  • Prev by Date: Very basic Bindings question
  • Next by Date: lauchd and svnserve
  • Previous by thread: Very basic Bindings question
  • Next by thread: Re: Very basic Bindings question
  • Index(es):
    • Date
    • Thread