The Dropdownmenu won't scroll when too many items
rico237 opened this issue · 9 comments
I'm using this array with 19 items on it, some items are then listed outside of the iphone screen and the menu don't scroll so users can't reach the 19th elements of my array ...
["Alimentaire","Artisanat","Bien-être","Décoration","E-commerce","Distribution","Hôtellerie","Immobilier","Informatique","Métallurgie","Médical","Nautisme","Paramédical","Restauration","Sécurité","Textile","Tourisme","Transport","Urbanisme"]
The code I used to dynamically load array into your menu from your demo project
`func prepareNavigationBarMenu(_ currentChoice: String) {
navigationBarMenu = DropDownMenu(frame: view.bounds)
navigationBarMenu.delegate = self
let toutesCat = ["Alimentaire","Artisanat","Bien-être","Décoration","E-commerce","Distribution","Hôtellerie","Immobilier","Informatique","Métallurgie","Médical","Nautisme","Paramédical","Restauration","Sécurité","Textile","Tourisme","Transport","Urbanisme"]
var catCells : Array<DropDownMenuCell>
catCells = []
for string in toutesCat {
let cell = DropDownMenuCell()
cell.textLabel!.text = string
cell.menuAction = #selector(ViewController.choose(_:))
cell.menuTarget = self
if currentChoice == cell.textLabel!.text {
cell.accessoryType = .checkmark
}
catCells.append(cell)
}
navigationBarMenu.menuCells = catCells
navigationBarMenu.selectMenuCell(catCells.first!)
// If we set the container to the controller view, the value must be set
// on the hidden content offset (not the visible one)
navigationBarMenu.visibleContentOffset =
navigationController!.navigationBar.frame.size.height + statusBarHeight()
// For a simple gray overlay in background
navigationBarMenu.backgroundView = UIView(frame: navigationBarMenu.bounds)
navigationBarMenu.backgroundView!.backgroundColor = UIColor.black
navigationBarMenu.backgroundAlpha = 0.7
}`
Screenshot :
I've got the same issue.
I will try to code a fix for this :)
Thanks for the patch, I'm going to review it.
Since we are working on a fix for this issue i can close it now :)
Don't forget to push to cocoapods cause i'm still getting the old version without the fix via cocoapods
the problem is titleview in navigation bars frame is set to 0 .If you add a frame ( actually you shouldnt need to but, in IOS 11 yes) then your dropdown will start to work
qmathe , while you are pushing a new version, can you please add a property that closes the animation but show instantly when set to true.