編集中に NSTableView セルに表示されている値を変更したい。私の要件は次のとおりです。最初に 234.5678978 のセル値を入力し、編集後、値は 0 桁の精度 (つまり 235) に切り上げられます。私の要件は、そのセルをクリックできるときに、特定の小数精度、たとえば 5 精度までの値を表示することです。この場合は 234.56790)。この機能を実現するにはどうすればよいですか。NSTableView のセルを編集するダブルクリックのアクションをキャプチャしようとしました。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editingDidEnd:)
name:NSControlTextDidEndEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editingDidBegin:)
name:NSControlTextDidBeginEditingNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editingDidChange:)
name:NSControlTextDidChangeNotification object:nil];
- (void)editingDidEnd:(NSNotification *)notification
{
NSLog(@"text editing fisnished");
}
- (void)editingDidBegin:(NSNotification *)notification
{
NSLog(@"text is being edited");
}
- (void)editingDidChange:(NSNotification *)notification
{
NSLog(@"text was being changed");
}
しかし、タブアウトでのみeditingDidEnd
呼び出され、他の 2 つのメソッドは呼び出されませんでした。