• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Troubles with NSTokenField delegate methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Troubles with NSTokenField delegate methods


  • Subject: Troubles with NSTokenField delegate methods
  • From: Максим Семенов <email@hidden>
  • Date: Thu, 03 Mar 2011 09:15:16 +0500


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

> От: Максим Семенов <email@hidden>
> Дата: 2 марта 2011 г. 11:12:51 GMT+05:00
> Кому: email@hidden
> Тема: 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@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

  • Prev by Date: Where to find the IOS SDK 3.0
  • Next by Date: Re: Where to find the IOS SDK 3.0
  • Previous by thread: Re: Where to find the IOS SDK 3.0
  • Next by thread: The 'Open with' option is automatically changed with my app when my app is installed
  • Index(es):
    • Date
    • Thread