Menu popover from bottom to top sliding iOS swift
Problem:
I want to show popover from bottom to top sliding like material design.How can i achieve that?
Solution:
First need to add expanding menu in pods and install it.Then proceed with the below code.
import ExpandingMenu
fileprivate func configMenuButton() {
let menuButtonSize: CGSize = CGSize(width: 50.0, height: 50.0)
menuButton = ExpandingMenuButton(frame: self.myBtn.frame, image:"ImgName", rotatedImage:"ImgName")
self.view.addSubview(menuButto
self.view.bringSubviewToFront(
menuButton.center = self.myBtn.center
var menuItems:[ExpandingMenuItem] = []
for i in 0..<OptionsList.allC
let menuItem = OptionsList(rawValue
let item1 = ExpandingMenuItem(size: menuButtonSize, title: menuItem?.title, image: (menuItem?.image)!, highlightedImage: (menuItem?.image)!, backgroundImage:"img", backgroundHighlightedImage: "imgSelected") { () -> Void in
self.didOptionSelection(index: i)
}
item1.tintColor = (menuItem?.bgColor)!
menuItems.append(item1)
}
menuButton.addMenuItems(
menuButton.clipsToBounds = true
}
//While click on menu the below function will be called
func didOptionSelection(index:Int) {
}
You can easily achieve that with above code.
Comments
Post a Comment