sunilsharma08 / IGCMenu

Grid and Circular Menu for iOS.
http://sunilsharma08.github.io/IGCMenu
MIT License
140 stars 21 forks source link

UITableViewController initialization(?) #8

Closed HackShitUp closed 7 years ago

HackShitUp commented 8 years ago

This is awesome. But is it possible to overlay this on a UITableViewController?

sunilsharma08 commented 8 years ago

Yes, you can easily overlay IGCMenu on UITableViewController. You have to just add button on controller view and make sure to bring button on top as

[self.view bringSubviewToFront:menuButton];

and it will work as expected.

HackShitUp commented 8 years ago

@sunilsharma08 it's not working, I think I'm initializing the button wrong? (I don't have a UIButton in the storyboard).

sunilsharma08 commented 8 years ago

You have to add button either in storyboard or programmatically and the pass the button reference to IGCMenu property menuButton as

igcMenu.menuButton = yourMenuButton;

This library does not make the bottom center button.It takes reference of your button and draws menu from that.

HackShitUp commented 8 years ago

Ok, I got it to show the menu button's options (ie: buy, home, etc.), but the menuButton doesn't appear even though I initialized it programatically. Here's the code:

var menuButton: UIButton!

Then in viewDidLoad():

menuButton = UIButton() menuButton.frame = CGRectMake(UIScreen.mainScreen().bounds.size.width/4, 100, 375, 667*1.25)

For IGCMenu...

//Pass refernce of menu button igcMenu.menuSuperView = UIApplication.sharedApplication().keyWindow!

// Bring to sub view UIApplication.sharedApplication().keyWindow!.bringSubviewToFront(menuButton)

I'm only using UIApplication.sharedApplication().keyWindow because this app already has UITabBarController in it.

sunilsharma08 commented 8 years ago

I think you forgot to add menu button to key window and add menu button in viewWillAppear not in viewDidLoad as

override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
        UIApplication.sharedApplication().keyWindow?.addSubview(menuButton)
    }

and in you are making button size really very big CGRectMake(UIScreen.mainScreen().bounds.size.width/4, 100, 375, 667*1.25) so in some device the button will cover whole screen. Try with small menu button size

CGRectMake(UIScreen.mainScreen().bounds.size.width/2 - 30, UIScreen.mainScreen().bounds.size.height - 80 , 60, 60)