qmathe / DropDownMenuKit

UIKit drop down menu, simple yet flexible and written in Swift
Other
303 stars 38 forks source link

The Dropdownmenu won't scroll when too many items #18

Closed rico237 closed 7 years ago

rico237 commented 7 years ago

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 :

simulator screen shot on iPhone 7+

sway0422 commented 7 years ago

I've got the same issue.

rico237 commented 7 years ago

I will try to code a fix for this :)

rico237 commented 7 years ago

Done https://github.com/qmathe/DropDownMenuKit/pull/20

qmathe commented 7 years ago

Thanks for the patch, I'm going to review it.

rico237 commented 7 years ago

Since we are working on a fix for this issue i can close it now :)

rico237 commented 7 years ago

Don't forget to push to cocoapods cause i'm still getting the old version without the fix via cocoapods

qmathe commented 7 years ago

I'll push a new version as soon as iOS 11 support is fixed (#19).

cagdastimurlenk commented 6 years ago

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

cagdastimurlenk commented 6 years ago

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.