Creating a floating menu in an iOS application

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.

enter image description here

  • Best way to cache images on ios app?
  • How to run a background JavaScript in Phonegap on iPhone - for timer/stopwatch?
  • iOS - How to draw a YUV image using openGL
  • Toolbar with “Previous” and “Next” for Keyboard inputAccessoryView
  • Simulated low memory warning not working
  • “an ssl error has occurred and a secure connection to the server cannot be made” connecting to Internal Development Server on phone only
  • My initial thoughts were to extend the UIViewController class and add the respective drawing/logic there, however, the application is comprised of a few other controllers, more specifically the UITableViewController which in itself extends UIViewController. Is there perhaps a good place for an extension perhaps? Or is there a more eloquent way of drawing the menu on specific views without the mass duplication of menu related code?

    The menu itself will be shown on most screens, so I need to selectively enable it. It’ll also be somewhat contextual based on the view/screen the user is currently on.

    Any awesome ideas?

    3 Solutions Collect From Internet About “Creating a floating menu in an iOS application”

    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() }
        }
    

    enter image description here

    You could use view controller containment. The menu can be its own view controller with its view laid transparently over top the content view controller.

    For example this can be set up in the storyboard by dragging out two container views into a vanilla view controller.

    There is another alternative with this great library :

    https://github.com/yoavlt/LiquidFloatingActionButton

    You just have to implement the delegate and the dataSource in your ViewController:

    let floatingActionButton = LiquidFloatingActionButton(frame: floatingFrame)
    floatingActionButton.dataSource = self
    floatingActionButton.delegate = self
    

    enter image description here