bind:toObject:withKeyPath:options: being called twice
bind:toObject:withKeyPath:options: being called twice
- Subject: bind:toObject:withKeyPath:options: being called twice
- From: Charles Srstka <email@hidden>
- Date: Sat, 21 Aug 2010 19:12:41 -0500
My custom view implements -optionDescriptionsForBinding: as follows:
- (NSArray *)optionDescriptionsForBinding:(NSString *)binding {
NSMutableArray *descs = [NSMutableArray arrayWithArray:[super optionDescriptionsForBinding:binding]];
if([binding isEqualToString:@“foo"]) {
NSAttributeDescription *desc = [[[NSAttributeDescription alloc] init] autorelease];
[desc setName:NSConditionallySetsHiddenBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:NO]];
[descs addObject:desc];
desc = [[[NSAttributeDescription alloc] init] autorelease];
[desc setName:NSConditionallySetsEnabledBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:NO]];
[descs addObject:desc];
desc = [[[NSAttributeDescription alloc] init] autorelease];
[desc setName:NSConditionallySetsEditableBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:YES]];
[descs addObject:desc];
}
return descs;
}
As expected, this causes Interface Builder to show the checkboxes for these three options. However, if I try to click one of them, bind:toObject:withKeyPath:options: gets called twice — the first time with these three options properly present in the options dictionary, but the second time with the options dictionary set to nil (or to a dictionary containing nothing but the value transformer, if there is one). The result of this is that trying to click one of the check boxes causes the checkbox to change momentarily but then flicker back to the default setting, and there’s no way to actually set these binding options.
Has anyone seen this before? What might be causing it?
Thanks,
Charles_______________________________________________
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