English 中文(简体)
页: 1 实地不要让我打上其他方言,而不是象征性的方言。 领域:成绩
原标题:NSTokenField does not let me type other strings than tokenField:completionsForSubstring:... returns

我的问题是,NS Token Field不允许我打上我所希望的任何案文,它只允许我打上列入NSArray的显示器,以示实地:证明:证明文件:索引Of Token:indexOfS selectedItem:回报。

- (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex      {
return [NSArray arrayWithObjects:@"AA", @"BB", @"CC", @"DD", nil];
}

My NSTokenField can only contain the above text-tokens. If I type for example XXX it does not appeared and it cannot be added.

自文件提到以来,为什么会出现这种情况。 “用户可进入一个无法列入可能完成清单的示意图,也可用于象征性的”

我失踪了吗?

最佳回答

选定的违约数值 页: 1

因此,如果在您的名单上出现子座 t,你要么需要将此规定为-1(否则,它将以你第一次完成的案文取代用户所用的案文)。

<>>>

只有在完成清单中,实际算出用户的预置物。 (这往往是正确的用户经验)。

- (NSArray *)tokenField:(NSTokenField *)tokenField completionsForSubstring:(NSString *)substring indexOfToken:(NSInteger)tokenIndex indexOfSelectedItem:(NSInteger *)selectedIndex
{
   NSArray *completions = [NSArray arrayWithObjects:@"AA", @"BB", @"CC", @"DD", nil];
   NSMutableArray *filteredCompletions = [NSMutableArray array];

   [completions enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
       if ([[obj lowercaseString] hasPrefix:[substring lowercaseString]])
           [filteredCompletions addObject:obj];
   }];

   return filteredCompletions;
}
问题回答

暂无回答




相关问题
C# delegate with string reference to c++ callback

I wrote a C# application that uses an unmanaged c++ dll via managed c++ dll. In the unmanaged dll, there s a callback that one of its params is std::string&. I can t seem to find the right way to ...

how to call anonymous delegate dynamically

I hava a delegate public delegate void Context(); And i had implemented it by anonymous method, public Context fakeHttpContext = () => { ... create fake ...

self.delegate = self; what s wrong in doing that?

self.delegate = self; what s wrong in doing that? and what is the correct way of doing it? Thanks, Nir. Code: (UITextField*)initWith:(id)sender:(float)X:(float)Y:(float)width:(float)hieght:(int)...

Compiler treatment of a Delegate

If i declare a delegate public delegate void firstDelegate(string str); firstDelegate handler = Strfunc; handler("Hello World"); .. static void Strfunc(string str) { Console....

Practical use of interface events [closed]

What is a good example of the power of interface events (declaring events inside interface)? Most of the times I have seen only public abstract methods inside interface.

Delegates in C#

I`m having some trouble in understanding how delegates in C# work. I have many code examples, but i still could not grasp it properly. Can someone explain it to me in "plain english"? Of course! ...

热门标签