Azuritul / AZDropdownMenu

A simple dropdown menu component for iPhone
http://azuritul.github.io/AZDropdownMenu
MIT License
193 stars 50 forks source link

The menu's position get shifted with the screen #23

Open martintjandra opened 8 years ago

martintjandra commented 8 years ago

I use this plugin with UITableViewController. When I scroll the table up, the menu's position get shifted up too offscreen. How to fix this?

martintjandra commented 8 years ago

Normal: simulator screen shot jun 13 2016 2 19 11 pm

Scrolled up a little: simulator screen shot jun 13 2016 2 13 30 pm

eddy80310 commented 8 years ago

under AZDropDownMenu.swift I had to change it to

` private func initMenu() { var navBarHeight = UINavigationController().navigationBar.frame.size.height var statusBarHeight = UIApplication.sharedApplication().statusBarFrame.size.height

    let frame = UIScreen.mainScreen().bounds
    let menuFrame = CGRectMake(0, navBarHeight + statusBarHeight, frame.size.width, menuHeight)

    menuView = UITableView(frame: menuFrame, style: .Plain)
    menuView.userInteractionEnabled = true
    menuView.rowHeight = CGFloat(itemHeight)
    if self.reuseId == nil {
        self.reuseId = DROPDOWN_MENU_CELL_KEY
    }
    menuView.dataSource = self
    menuView.delegate = self
    menuView.scrollEnabled = false
    menuView.accessibilityIdentifier = "MENU"
    menuView.separatorColor = menuConfig?.menuSeparatorColor
    let panGesture = UIPanGestureRecognizer(target: self, action: #selector(AZDropdownMenu.handlePan(_:)))
    panGesture.delegate = self
    menuView.addGestureRecognizer(panGesture)
    addSubview(menuView)
}`