Krzysztof
Krzysztof

Reputation: 1471

How to resize NSTableView cell so that text view inside does not loose focus

I have NSTableView with custom NSTableViewRow. When user types in text i would like the row to resize while user is typing. Now if i call on tableView reloadData cell looses the focus.

Is there any other way to make NSTableView resize the heights ?

Upvotes: 0

Views: 279

Answers (2)

Krzysztof
Krzysztof

Reputation: 1471

For anyone else having the problem:

I haven't found any way of reloading row height in NSTableView without loosing focus. So My solution was to get rid of NSTableView and use NSScrollView with some customized NSViews instead.

Update: I recently noticed method which can be used to resize cell, dont know if it makes the text view not loose the focus, but thought it might help:

[self.tableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:row]];

Upvotes: 0

Cory
Cory

Reputation: 2312

Instead of reloading all the data you can use

reloadDataForRowIndexes:columnIndexes:

this reloads the particular row/column you specify (in your case the one that was just edited), and preserves the tableview selection.

Upvotes: 1

Related Questions