rushisangani / RSSelectionMenu

An elegant selection list or dropdown menu for iOS with single or multiple selections.
MIT License
351 stars 91 forks source link

Default Selection #57

Closed fcbmojtaba1995 closed 6 years ago

fcbmojtaba1995 commented 6 years ago

Thank for library. How to set item default selected in single selection?

rushisangani commented 6 years ago

You need to pass selectedIems as an array to show default selection.

fcbmojtaba1995 commented 6 years ago

Can you give an example?

rushisangani commented 6 years ago

@fcbmojtaba1995

` // set default selected items when menu present on screen. // Here you'll get onDidSelectRow

selectionMenu.setSelectedItems(items: simpleSelectedArray) { (text, isSelected, selectedItems) in

// update your existing array with updated selected items, so when menu presents second time updated items will be default selected. self.simpleSelectedArray = selectedItems } `

see example for more details.