I have a tableview with one textboxcolumn and 7 checkbox columns.
This table will eventually be filled with data, and at some later point i have to remove one of the columns somewhere in the middle. What happens with the array associated with the table? How should i proprtly handle this? How would you do it? Please be clear in your answer since i am a beginner!
I have a tableview with one textboxcolumn and 7 checkbox columns. This table will
Share
Have you learned how to provide data to the table view? I suggest getting that working before you try to solve this problem.
There are two ways to get data to the table view: a table view data source and Cocoa Bindings.
If you use a data source, you’ll need to write
-tableView:objectValueForTableColumn:row:so that it works correctly before or after the column is removed. One way to do this is to base that code on the column’s identifier instead of its index. The identifier is a value you set on the column in your nib (look for Identifier). This is the same technique you can use to provide the correct data to reordered columns.If you use Cocoa Bindings, you can just remove a column and the other columns will keep working.
If you’re using an array or an array controller, in neither case will anything automatically happen to the array when you remove a column.