exyte / fan-menu

Menu with a circular layout based on Macaw
MIT License
728 stars 58 forks source link

FanMenu inside toolBar? #44

Closed brduffy closed 5 years ago

brduffy commented 5 years ago

Hi, I'm trying to put a fan menu inside my toolbar. Here is the toolbar item I have defined (the fan menu is clipped by the frame size, but if I don't provide a frame size then it does not show up at all in the toolbar. Is there any way to do this?

Thanks

Brian

lazy var barFanMenu: UIBarButtonItem = { var fanMenu = FanMenu() fanMenu.button = FanMenuButton( id: "main", image: UIImage(named: "chicken")?.withRenderingMode(.alwaysTemplate), color: Color(val: 0x7C93FE) )

    fanMenu.items = [
        FanMenuButton(
            id: "exchange_id",
            image: "desserts",
            color: Color(val: 0x9F85FF)
        ),
        FanMenuButton(
            id: "visa_id",
            image: "bread",
            color: Color(val: 0xF55B58)
        )
    ]

    fanMenu.menuRadius = 90.0
    fanMenu.duration = 0.2
    fanMenu.delay = 0.05
    fanMenu.interval = (Double.pi, 2 * Double.pi)
    fanMenu.frame = CGRect(x: 0, y: 0, width: 180, height: 90)
    fanMenu.clipsToBounds = false

    let b: UIBarButtonItem = UIBarButtonItem(customView: fanMenu)

    return b
}()
amarunko commented 5 years ago

Hi, @brduffy, I think it impossible, btw you can use custom toolbar created from UIStackView for example. Also, you can try the following way: Do the custom layer path for toolbar (something closer to this functional described here) Then insert the fan menu into views hierarchy below the actual bar or just in view, maybe it will work.