Начало переадресованного сообщения:

> От: Максим Семенов <[email protected]>
> Дата: 2 марта 2011 г. 11:12:51 GMT+05:00
> Кому: [email protected]
> Тема: NSTokenField delegate methods
> 
> Hi everyone,
> 
> I have some troubles with NSTokenField delegate methods.
> 
> In Apple's "Token Field Programming Guide for Cocoa" in section "Basic 
> Interaction With the Delegate" tells that when the user type some text in 
> token field the delegate receives the 
> tokenField:completionsForSubstring:indexOfToken:indexOfSelectedItem: message.
> 
> And when the user types the tokenizing character th delegate receives the 
> tokenField:representedObjectForEditingString: message.
> 
> So when i implemented this methods its behave themselves in a very different 
> way.
> 
> There is my implementation of delegate methods:
> 
>      - (NSArray *)tokenField:(NSTokenField *)tokenFieldArg
>      completionsForSubstring:(NSString *)substring 
>                 indexOfToken:(NSInteger)tokenIndex 
>          indexOfSelectedItem:(NSInteger *)selectedIndex {
> 
>               NSLog(@"completionsForSubstring: %@", substring);
>               return [NSArray array];
>      }    
> 
> 
>      - (id)tokenField:(NSTokenField *)tokenField
>      representedObjectForEditingString:(NSString *)editingString {
> 
>               NSLog(@"representedObjectForEditingString: %@", editingString);
>               return editingString;
>      }
> 
> 
> And there is a log when i type "maksim" in token field and then erase it:
> 
> 2011-03-01 19:03:01.286 Aurum[23269:a0f] representedObjectForEditingString: m
> 2011-03-01 19:03:01.287 Aurum[23269:a0f] representedObjectForEditingString: m
> 2011-03-01 19:03:01.493 Aurum[23269:a0f] completionsForSubstring: m
> 2011-03-01 19:03:01.633 Aurum[23269:a0f] representedObjectForEditingString: ma
> 2011-03-01 19:03:01.633 Aurum[23269:a0f] representedObjectForEditingString: ma
> 2011-03-01 19:03:01.637 Aurum[23269:a0f] completionsForSubstring: ma
> 2011-03-01 19:03:03.737 Aurum[23269:a0f] representedObjectForEditingString: 
> mak
> 2011-03-01 19:03:03.737 Aurum[23269:a0f] representedObjectForEditingString: 
> mak
> 2011-03-01 19:03:03.741 Aurum[23269:a0f] completionsForSubstring: mak
> 2011-03-01 19:03:05.089 Aurum[23269:a0f] representedObjectForEditingString: 
> maks
> 2011-03-01 19:03:05.089 Aurum[23269:a0f] representedObjectForEditingString: 
> maks
> 2011-03-01 19:03:05.094 Aurum[23269:a0f] completionsForSubstring: maks
> 2011-03-01 19:03:05.841 Aurum[23269:a0f] representedObjectForEditingString: 
> maksi
> 2011-03-01 19:03:05.841 Aurum[23269:a0f] representedObjectForEditingString: 
> maksi
> 2011-03-01 19:03:05.845 Aurum[23269:a0f] completionsForSubstring: maksi
> 2011-03-01 19:03:06.697 Aurum[23269:a0f] representedObjectForEditingString: 
> maksim
> 2011-03-01 19:03:06.697 Aurum[23269:a0f] representedObjectForEditingString: 
> maksim
> 2011-03-01 19:03:06.701 Aurum[23269:a0f] completionsForSubstring: maksim
> 2011-03-01 19:03:12.353 Aurum[23269:a0f] representedObjectForEditingString: 
> maksi
> 2011-03-01 19:03:12.354 Aurum[23269:a0f] representedObjectForEditingString: 
> maksi
> 2011-03-01 19:03:12.853 Aurum[23269:a0f] representedObjectForEditingString: 
> maks
> 2011-03-01 19:03:12.854 Aurum[23269:a0f] representedObjectForEditingString: 
> maks
> 2011-03-01 19:03:12.936 Aurum[23269:a0f] representedObjectForEditingString: 
> mak
> 2011-03-01 19:03:12.937 Aurum[23269:a0f] representedObjectForEditingString: 
> mak
> 2011-03-01 19:03:13.020 Aurum[23269:a0f] representedObjectForEditingString: ma
> 2011-03-01 19:03:13.020 Aurum[23269:a0f] representedObjectForEditingString: ma
> 2011-03-01 19:03:13.103 Aurum[23269:a0f] representedObjectForEditingString: m
> 2011-03-01 19:03:13.104 Aurum[23269:a0f] representedObjectForEditingString: m 
> 
> So can anyone explain me what's going wrong and why token field behave 
> themself so strange?
> 
> P. S. Sorry for bad english

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to