简体   繁体   中英

NSTableView - how to change string just before editing

I have a table of file names. I want the user to be able to change values but i want to allow changing only the name without its extension.

So, if there is a cell with the value filename.zip and the user start editing that cell i want him to be able to edit only the filename part without the .zip extension.

How can i do that?

Well, I guess you should apply an NSFormatter to every cell of your table. NSFormatter lets you customize the output of the cells. You should read in the docs to understand it better, I haven't used one myself, but you could customize the output depending on the cell's state (if it's being edited or not). I'm a newbie myself ... so I'm not sure if this is the right solution, but I hope this points you to the right direction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM