当我在一个NSTextFieldCell中选择一个NSTableView时,行为是不同的,这取决于是否选择了行。
我想让单元格进入编辑模式,在这两种情况下,1点击后。
发布于 2013-10-15 05:18:20
在下面实现此方法,它将编辑您的单元格:-
- (void)editColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex withEvent:(NSEvent *)theEvent select:(BOOL)flag
发布于 2013-10-16 00:28:25
我想你想要的是只需一次点击就可以编辑你的细胞。为此,您需要子类您的表视图并捕获它的mousedown: event作为
- (void)mouseDown:(NSEvent *)theEvent
{
NSPoint globalLocation = [theEvent locationInWindow];
NSPoint localLocation = [self convertPoint:globalLocation fromView:nil];
NSInteger clickedRow = [self rowAtPoint:localLocation];
NSInteger clickedCol = [self columnAtPoint:localLocation];
[super mouseDown:theEvent];
[self editColumn:clickedCol row:clickedRow withEvent:theEvent select:YES];
}
https://stackoverflow.com/questions/19382067
复制