有什么建议?
感谢迈克尔的起始代码,它非常接近最终的工作!这是我使用的最终代码,希望它对其他人有帮助:
- (voID) textDIDEndEditing: (NSNotification *) notification { NSInteger editedColumn = [self editedColumn]; NSInteger editedRow = [self editedRow]; NSInteger lastColumn = [[self tableColumns] count] - 1; NSDictionary *userInfo = [notification userInfo]; int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue]; [super textDIDEndEditing: notification]; if ( (editedColumn == lastColumn) && (textMovement == NSTabTextMovement) && editedRow < ([self numberOfRows] - 1) ) { // the tab key was hit while in the last column,// so go to the left most cell in the next row [self selectRowIndexes:[NSIndexSet indexSetWithIndex:(editedRow+1)] byExtendingSelection:NO]; [self editColumn: 0 row: (editedRow + 1) withEvent: nil select: YES]; }}解决方法 子类UItableVIEw并添加代码以捕获textDIDEndEditing调用.
然后,您可以根据以下内容决定做什么:
- (voID) textDIDEndEditing: (NSNotification *) notification{ NSDictionary *userInfo = [notification userInfo]; int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue]; if ([self selectedColumn] == ([[self tableColumns] count] - 1)) (textMovement == NSTabTextMovement) { // the tab key was hit while in the last column,// so go to the left most cell in the next row [yourtableVIEw editColumn: 0 row: ([self selectedRow] + 1) withEvent: nil select: YES]; } [super textDIDEndEditing: notification]; [[self window] makeFirstResponder:self];} // textDIDEndEditing
此代码未经过测试……没有保修……等等.您可能需要将[super textDIDEndEditing:]调用移动到最右侧单元格中的选项卡.但希望这会帮助你走到终点.让我知道!
总结以上是内存溢出为你收集整理的macos – NSTableView命中选项卡在编辑时从一行跳到另一行全部内容,希望文章能够帮你解决macos – NSTableView命中选项卡在编辑时从一行跳到另一行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)