DropDownMenuKit
DropDownMenuKit copied to clipboard
Do you have an example code for the 'sort' drop down you show in the screen shot?
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
ie this one - https://camo.githubusercontent.com/ca29b98193b03d95dd691c9ec8e2308b2a8b4f54/687474703a2f2f7777772e7175656e74696e6d617468652e636f6d2f6769746875622f44726f70446f776e4d656e754b69742f506c6163652532304c697374253230416374696f6e2532304d656e752532302d2532306950686f6e65253230352e706e67
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.