|
|
Bindings Stuff
|
|
|
|
Junior Member
Join Date: Jan 2003
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
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"
|
|
|
|
|
|
|
|
|
Junior Member
Join Date: Jan 2003
Status:
Offline
|
|
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
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Aug 2001
Status:
Offline
|
|
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 Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|