FROM : Marco Scheurer
DATE : Tue Apr 26 23:45:54 2005
On Apr 26, 2005, at 23:17, Todd Ransom wrote:
> The code looks like this:
>
> - (NSString *)bindingKeyForTableColumnIdentifier: (NSString *)
> identifier {
>
> NSArray *keys = [NSArray arrayWithObjects: @"name", @"notes",
> @"status", nil];
> NSArray *identifiers = [NSArray arrayWithObjects: @"Name",
> @"Notes", @"Status", nil];
>
> NSDictionary *keyForIdentifier = [dictionaryWithObjects: keys
> forKeys: identifiers;
>
> return [keyForIdentifier valueForKey: identifier];
> }
>
> - (BOOL) tableViewAddColumnWithIdentifier: (NSString *)identifier {
>
> NSString *bindingKey = [self
> bindingKeyForTableColumnIdentifier: identifier];
>
> [create a table column, bind it, add it to a table]
>
> }
>
> The theory was that subclasses would override both methods,
> returning the appropriate key to bind to and implementing whatever
> specifics were required for the table column (popup button cells,
> date formatters, etc.).
>
> It all worked fine except I wanted the subclasses to defer to super
> for columns shared by all views.
Maybe bindingKeyForTableColumnIdentifier in subclasses needs to
augment the dictionary of the superclass? That would be easier with a
dictionary method you can override:
- (NSDictionary *) keyForIdentifierDictionary
{
NSMutableDictionary *keyForIdentifier = [NSMutableDictionary
dictionaryWithObjectsAndKeys...];
[keyForIdentifier addEntriesFromDictionary:[super
keyForIdentifierDictionary]];
return keyForIdentifier;
}
marco
Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
DATE : Tue Apr 26 23:45:54 2005
On Apr 26, 2005, at 23:17, Todd Ransom wrote:
> The code looks like this:
>
> - (NSString *)bindingKeyForTableColumnIdentifier: (NSString *)
> identifier {
>
> NSArray *keys = [NSArray arrayWithObjects: @"name", @"notes",
> @"status", nil];
> NSArray *identifiers = [NSArray arrayWithObjects: @"Name",
> @"Notes", @"Status", nil];
>
> NSDictionary *keyForIdentifier = [dictionaryWithObjects: keys
> forKeys: identifiers;
>
> return [keyForIdentifier valueForKey: identifier];
> }
>
> - (BOOL) tableViewAddColumnWithIdentifier: (NSString *)identifier {
>
> NSString *bindingKey = [self
> bindingKeyForTableColumnIdentifier: identifier];
>
> [create a table column, bind it, add it to a table]
>
> }
>
> The theory was that subclasses would override both methods,
> returning the appropriate key to bind to and implementing whatever
> specifics were required for the table column (popup button cells,
> date formatters, etc.).
>
> It all worked fine except I wanted the subclasses to defer to super
> for columns shared by all views.
Maybe bindingKeyForTableColumnIdentifier in subclasses needs to
augment the dictionary of the superclass? That would be easier with a
dictionary method you can override:
- (NSDictionary *) keyForIdentifierDictionary
{
NSMutableDictionary *keyForIdentifier = [NSMutableDictionary
dictionaryWithObjectsAndKeys...];
[keyForIdentifier addEntriesFromDictionary:[super
keyForIdentifierDictionary]];
return keyForIdentifier;
}
marco
Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
| Related mails | Author | Date |
|---|---|---|
| Todd Ransom | Apr 26, 20:28 | |
| Marco Scheurer | Apr 26, 22:05 | |
| Todd Ransom | Apr 26, 22:20 | |
| Ondra Cada | Apr 26, 22:32 | |
| Greg Titus | Apr 26, 22:57 | |
| Marco Scheurer | Apr 26, 23:09 | |
| Todd Ransom | Apr 26, 23:17 | |
| Marco Scheurer | Apr 26, 23:45 | |
| Ondra Cada | Apr 26, 23:54 | |
| glenn andreas | Apr 26, 23:57 | |
| Todd Blanchard | Apr 27, 00:22 | |
| Todd Ransom | Apr 27, 00:30 | |
| Ondra Cada | Apr 27, 00:36 | |
| Todd Ransom | Apr 27, 00:38 | |
| Marco Scheurer | Apr 27, 01:03 | |
| Dan Treiman | Apr 27, 01:40 | |
| Ondra Cada | Apr 27, 01:47 |






Cocoa mail archive

