Creating a floating menu in an iOS application

前端 未结 3 765
轻奢々
轻奢々 2021-01-07 02:16

Looking to create a floating menu in Swift for an iOS application I am developing. Something along the lines of the little red circle menu as shown in the following image. <

3条回答
  •  一生所求
    2021-01-07 02:52

    You can create your own with the animations and all the things, or you can check this library

    https://github.com/lourenco-marinho/ActionButton

    var actionButton: ActionButton!
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
            let twitterImage = UIImage(named: "twitter_icon.png")!
            let plusImage = UIImage(named: "googleplus_icon.png")!
    
            let twitter = ActionButtonItem(title: "Twitter", image: twitterImage)
            twitter.action = { item in println("Twitter...") }
    
            let google = ActionButtonItem(title: "Google Plus", image: plusImage)
            google.action = { item in println("Google Plus...") }
    
            actionButton = ActionButton(attachedToView: self.view, items: [twitter, google])
            actionButton.action = { button in button.toggleMenu() }
        }
    

提交回复
热议问题