Re: Looking for XCode binding version of CurrencyConverter Sample Code
Re: Looking for XCode binding version of CurrencyConverter Sample Code
- Subject: Re: Looking for XCode binding version of CurrencyConverter Sample Code
- From: Shaun Wexler <email@hidden>
- Date: Tue, 4 Nov 2003 13:05:34 -0800
On Nov 4, 2003, at 7:23 AM, Steve Sheets wrote:
Does anyone know where I can find the sample code for the
CurrencyConverter example, the version that uses Panther Controller
Layer binding (easily the most interesting feature of the new Panther
release for myself as a developer)?
I am trying to learn/understand binding, and any example code that
actually functions would be a great step forward. I tried to write my
first program using the controller layer, but was unable to make it
function. Obviously I left out a step. It was easy to make a mistake,
with the screen shots from "Introduction to Cocoa Controller Layer"
not matching actual XCode preferences.
Is there any other source code examples that demonstrates the
Controller Layer well?
Add this method...
+ (void)initialize
{
//[super initialize];
[self setKeys:[NSArray arrayWithObjects:@"dollarsToConvert",
@"exchangeRate", nil]
triggerChangeNotificationsForDependentKey:@"amountInOtherCurrency"];
}
...which is a Class equivalent of wrapping each instance's setter
methods like this:
- (void)setDollarsToConvert:(double)dollars
{
[self willChangeValueForKey:@"amountInOtherCurrency"];
dollarsToConvert = dollars;
[self didChangeValueForKey:@"amountInOtherCurrency"];
}
- (void)setExchangeRate:(double)rate
{
[self willChangeValueForKey:@"amountInOtherCurrency"];
exchangeRate = rate;
[self didChangeValueForKey:@"amountInOtherCurrency"];
}
Apple should update their sample code on the website, ASAP. ;)
--
Shaun Wexler
MacFOH
http://www.macfoh.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.