Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Bindings Stuff

Bindings Stuff
Thread Tools
Stevos
Junior Member
Join Date: Jan 2003
Status: Offline
Reply With Quote
Dec 8, 2003, 11:17 PM
 
How exactly can you inform Interface Builder that your NSView subclass supports a given binding?

For example, I created a class that had the following:
Code:
+ (void)initialize { [self exposeBinding:@"string"]; } - (void)setString: (NSString *)string { _string = string; } - (NSString *)string { return _string; }
That should, I think, do everything in order to make the object both KVC compliant and respond to the binding. When I dragged the header to IB, though, I only get "hidden" for bindings for that view.

Has anyone ever used bindings for anything real?
swont
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Dec 8, 2003, 11:20 PM
 
Originally posted by Stevos:
How exactly can you inform Interface Builder that your NSView subclass supports a given binding?

For example, I created a class that had the following:
Code:
+ (void)initialize { [self exposeBinding:@"string"]; } - (void)setString: (NSString *)string { _string = string; } - (NSString *)string { return _string; }
That should, I think, do everything in order to make the object both KVC compliant and respond to the binding. When I dragged the header to IB, though, I only get "hidden" for bindings for that view.

Has anyone ever used bindings for anything real?
I'm working on a program that uses them, but:

a) it's pretty small (~1500 lines)
b) I haven't worked out how to do what you're asking about
c) I think NSArrayController needs a delegate method "selectionDidChange"
     
Stevos  (op)
Junior Member
Join Date: Jan 2003
Status: Offline
Reply With Quote
Dec 9, 2003, 12:16 AM
 
I found the answer.

You need to make your view into an IB pallete to be able to do this. I forsee one huge pallete that I'll be able to grab views like crazy from. Maybe I'll write something for CDC on this.
swont
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Dec 9, 2003, 12:59 AM
 
Originally posted by Stevos:
I found the answer.

You need to make your view into an IB pallete to be able to do this. I forsee one huge pallete that I'll be able to grab views like crazy from. Maybe I'll write something for CDC on this.
GAH! I wish IB could read more into the code part of projects. Say, have it check -awakeFromNib, or +initialize or something for calls to exposeBinding:
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:36 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,