Open netsmith opened 4 years ago
Sorry to chase Im about to implement it using a different library but I much prefer your :)
Hello,
Here is the code I was using for the menu visible in the screenshot you're referring to:
let sortCell = DropDownMenuCell()
let sortSwitcher = UISegmentedControl(items: localizedSortingChoices)
allowedSortingKeys = ["name", "rating", "distance", "creationDate"]
sortSwitcher.apportionsSegmentWidthsByContent = true
sortSwitcher.selectedSegmentIndex = allowedSortingKeys.index(of: sortingKey)!
sortSwitcher.addTarget(self, action: #selector(PlaceListController.sort(_:)), for: .valueChanged)
sortCell.customView = sortSwitcher
sortCell.textLabel!.text = "Sort"
sortCell.imageView!.image = UIImage(named: "SortingArrows")
sortCell.showsCheckmark = false
sortCell.layoutMargins = .zero
sortCell.preservesSuperviewLayoutMargins = false
dropDownMenu.menuCells = [selectCell, sortCell]
The code was written for iOS 8 to 11, I haven't tested it for more recent iOS versions, so you might need to adjust it.
the version where there is up and down arrows and also the segment where you select what you want to sort on? Its spot on what I'm looking for.
Thanks