NSImageCell、NSTextFieldCells、およびNSPopUpButtonCellを使用してNSCellのカスタムサブクラスを作成しました。カスタムセル内のNSPopUpButtonCellがクリックされてもポップアップしない
私が使用してポップアップの細胞を初期化しています:私のアプリを実行中にポップアップセルをクリックしたときに
myPopUpCell = [[NSPopUpButtonCell alloc] init];
[myPopUpCell setBordered:NO];
[myPopUpCell setAutoenablesItems:NO];
[myPopUpCell addItemsWithTitles:[NSArray arrayWithObjects:@"Item1", @"Item2", @"Item3"]];
そしてdrawInteriorWithFrame:inView:
でそれを描くすべてが点を除いて、偉大な動作しているようですセルがポップアップしません。何が間違っているかもしれないかについての示唆?
多分、切り取りと貼り付けのエラーですが、arrayWithObjectsリストはnilで終了する必要があります。例えば[myPopUpCell addItemsWithTitles:[NSArray arrayWithObjects:@ "Item1"、@ "Item2"、@ "Item3"、nil]]; – Abizern