I am trying to delete the selected tag action from a button to remove the selected token in NSTokenField.
@IBAction func deleteSelectedTag (From: AnyObject) {fieldEditor = (tagTokenField.cell)! NSCell). FieldEditorForView (tagTokenField) if fieldEditor? .selectedRanges.count & gt; 0 {fieldEditor.delete}}
Any code does not remove this selected token code?
The only way I got this to do this was to edit the array that NSTokenField The value
was bound to use the range selected by the field editor:
@IBAction func deleteSelectedTag (From: AnyObject) {fieldEditor = (tagTokenField.cell)! NSCell) .fieldEditorForView (tagTokenField) if the field sender? .selectedRanges.count & gt; 0 {Range = Field Sender !! Selected Rings first! NSRange fieldEditor! .setSelectedRange (NSMakeRange (0, 0)) // None of the selected selected tags! After the test
after the test, I found that the selected range is always location
. > Gives an NSRN with token index and length
number of selected tokens at least I found no way to select non closest tokens in Nstikonfield.
No comments:
Post a Comment