Re: IBOutlet & NSNumber
Re: IBOutlet & NSNumber
- Subject: Re: IBOutlet & NSNumber
- From: Ken Thomases <email@hidden>
- Date: Sun, 14 Oct 2012 00:38:39 -0500
On Oct 13, 2012, at 11:17 PM, Randy Widell wrote:
> Wow. Woah. OK, sorry my ignorance offends.
I didn't express offense. At least, I didn't intend to.
> What in the world was I trying to do…I was trying to bind the selection index of a NSComboBox to a NSNumber because the Apple Cocoa bindings document for NSComboBox says the value can be bound to a NSNumber.
It can be bound to a _property_ of some object where the type of that property is NSNumber.
> Using -init didn't seem so nonsensical to me. It could it init with 0. It could init with NaN. But, you're right, -init is not listed in the NSNumber class reference and that should have been a clue.
Well, more to the point: an NSNumber is immutable. It can only have the value it was initialized with. So, if you instantiate one in a NIB, whether it got a value of 0 or NaN, it would be stuck with that value forever.
So, my point was: what good is it to bind a view's selection (or whatever) to a constant value?
> Anyway, cool, I just decided to use -indexOfSelectedItem on a NSComboBox outlet when the sheet finishes.
That works, but it would also have worked to bind the value binding of the NSComboBox to a property of some controller object. My concern is that you were trying to bind it to an object (rather than a property of an object) which betrays a fundamental confusion, and I wanted to bring that out into the open so you could work through it.
Regards,
Ken
_______________________________________________
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