Create a circular menu in ios with swift

4

I need to make a menu in IOS , that when the application starts, a menu like this will appear:

I have been looking at bookstores but none resemble what I need.

I've also tried with constraints but I can not make it look like

Is there any way to do this? Is there a library or any class of

asked by Joacer 13.10.2016 в 09:25
source

4 answers

3

you could try doing it manually and assigning each item of the menu separately in the position you want

var width = UIScreen.main.bounds.width
    var height = UIScreen.main.bounds.height

    let button = UIButton()
    button.frame.size.width = 50
    button.frame.size.height = 50
    button.layer.cornerRadius = button.frame.size.width / 2
    button.layer.backgroundColor = UIColor.red.cgColor
    button.frame.origin.x = width / 2 - 25
    button.frame.origin.y = height / 2 - 25
    // -25 debido a que el punto de anclaje es el 0.0 del boton se le resta la mitad de su tamaño para que quede centrado en la pantalla
    view.addSubview(button)

    let button1 = UIButton()
    button1.frame.size.width = 50
    button1.frame.size.height = 50
    button1.layer.cornerRadius = button.frame.size.width / 2
    button1.layer.backgroundColor = UIColor.blue.cgColor
    button1.frame.origin.x = width * 0.35 - 25
    button1.frame.origin.y = height * 0.35 - 25
    view.addSubview(button1)

    let button2 = UIButton()
    button2.frame.size.width = 50
    button2.frame.size.height = 50
    button2.layer.cornerRadius = button.frame.size.width / 2
    button2.layer.backgroundColor = UIColor.green.cgColor
    button2.frame.origin.x = width * 0.20 - 25
    button2.frame.origin.y = height * 0.5 - 25
    view.addSubview(button2)

    
answered by 16.10.2016 в 23:13
3

I've been looking around a bit and I've found a few bookstores that could be of help. Then I put the ones I found and I think they can be useful:

  • ALRadialMenu : A radial / circular menu with Spring animations. It is developed in Swift.

  • Circle Menu : A menu radial / circular with animations. You can customize the number of buttons from 1 to 10, even more. Written in Swift.

  • KYCircleMenu : A circular menu with animation. You can customize the number of buttons between 1 and 6. Written in Objective-C.

I hope someone will help you.

Merry Christmas !!!

    
answered by 25.12.2016 в 20:03
2

I think it's possible to generate with the standard library of UIKit applications, anyway in case it's really complex the animation you could use Sprite Kit: link

I leave an example that I generated with standard UIKit:

** Stack score does not let me upload more images, but it looks good on the device.

    
answered by 13.10.2016 в 14:51
1

Well here is one that in my opinion does exactly what you ask for.

It's very nice, too. You just have to add the sections you want and modify some things to be your taste.

You'll tell me if it's useful.

    
answered by 25.12.2016 в 12:37