berkb
berkb

Reputation: 612

How Can I Clear Selection of NSComboBox in Swift or Objective-C?

We can clear the selection of ComboBox coding this:

combobox.SelectedIndex=-1;

with C# on Windows. However, it this coding methodology cannot run for macOS and iOS NSComboBox with Swift or Objective - C. What is the real solution ? Thanks.

Upvotes: 1

Views: 1069

Answers (1)

mschmidt
mschmidt

Reputation: 2790

Look in the documentation. NSComboBox has a method:

func deselectItem(at index: Int)

and to get the index of the selected item:

var indexOfSelectedItem: Int { get }

Upvotes: 3

Related Questions