Re: IBOutlet & NSNumber
Re: IBOutlet & NSNumber
- Subject: Re: IBOutlet & NSNumber
- From: Ken Thomases <email@hidden>
- Date: Sat, 13 Oct 2012 22:52:32 -0500
On Oct 13, 2012, at 9:49 PM, Randy Widell wrote:
> Quick question… For some reason I cannot find an answer.
>
> I have a NSWindowController subclass and I want to bind the selection index of a NSComboBox to a NSNumber that is an IBOutlet of the NSWindowController subclass. I have a NSNumber object in the window's XIB and the object is linked to the outlet in the subclass, but the outlet is always nil.
>
> Is there something special about NSNumber? Other object types seem to work.
How could that NSNumber be initialized? It could only be via -init. A quick test here shows that [[NSNumber alloc] init] returns nil. I.e. it fails, because that's a nonsensical thing to do.
So is putting an NSNumber in a NIB. What in the world are you trying to do? In general, it makes no sense to put things other than views or controller objects into NIBs. NSNumbers are value objects, suitable for the model layer of your app.
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