我想使用自定义NSFormatter来判断NSTokenField内部字符串的长度。
我已经实现了NSFormatter并将其连接到xib中,所有这些,现在当我运行我的应用程序时,格式化程序inplace连接到NSTokenField我得到了这个错误:
2011-12-31 18:15:11.761 MyApp[4706:a0f] -[NSCFArray length]: unrecognized selector sent to instance 0xf4a530
(gdb) describe 0xf4a530
Undefined command: "describe". Try "help".
(gdb) p 0xf4a530
$1 = 16033072
(gdb) po 0xf4a530
<NSCFArray 0xf4a530>(
{
Format = "%01d";
FormatIndex = 0;
Name = "$Counter$";
},
{
Format = "";
Name = hey;
}
)
现在我明白了被评估的textcell确实包含了一个项目数组,因此我需要将这些项目转换为字符串,但在我的代码中出现错误的地方是:
//Set this so that user can't enter a super long amount and overflow the character array lower in the engine.
[fieldFormatter setMaximumLength:40];
我只是在评估fieldFormatter对象并将其成员变量int设置为40 ......真的不应该评估文本了吗......对吗?