evnaz / ENSwiftSideMenu

A simple side menu for iOS written in Swift.
MIT License
1.82k stars 281 forks source link

How to adapt ENSwiftSideMenu to iPad #184

Closed atalayasa closed 6 years ago

atalayasa commented 6 years ago

I am using ENSwiftSideMenu when I try to use it iPad it is not fit the screen how can I adapt side menu controller according to iPad? I am using following code in my sideNavigationController class

        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let menu = storyboard.instantiateViewController(withIdentifier: "MenuTableViewController") as! MenuTableViewController
        sideMenu = ENSideMenu(sourceView: self.view, menuViewController: menu, menuPosition: .left)
        sideMenu?.menuWidth = UIScreen.main.bounds.width * 0.8
atalayasa commented 6 years ago

I have found it myself if anyone needs it.

let MinHeight: CGFloat = 100.0
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
    let tHeight = tableView.bounds.height

    let temp = tHeight/CGFloat(items.count)  //Item size on your side menu

    return temp > MinHeight ? temp : MinHeight
}