I tried using AwesomeMenu in my code, the one which is here:
https://github.com/levey/AwesomeMenu
It’s usage is very simple, as listed in the github page. I followed it as-is. But the menu is not appearing in the UI. Am using iOS 5.0 and Xcode 4.2, with iOS Simulator for testing.
This is what I did:
in my ViewController.h
...
#import "AwesomeMenu.h"
#import "AwesomeMenuItem.h"
...
// I included the AwesomeMenuDelegate here
@interface com_FirstViewController : UIViewController <UITableViewDelegate, UITableViewDataSource,AwesomeMenuDelegate> {
...
}
@property (nonatomic, retain) IBOutlet AwesomeMenu *awesomeMenu;
...
In the Storyboard
I have created a UIView instance, positioned & resized it where I want it to, changed its class to type ‘AwesomeMenu’, and linked its ‘Referencing Outlet’ to the IBOutlet property ‘awesomeMenu’.
In ViewController.m
...
@synthesize awesomeMenu;
...
AwesomeMenuItem *starMenuItem1;
AwesomeMenuItem *starMenuItem2;
...
...
// This method seems to be getting called, as I see the log messages
-(void) initializeSpringMenu {
NSLog(@"InitializeSpringMenu: entered");
UIImage *storyMenuItemImage = [UIImage imageNamed:@"GooglePlus.png"];
UIImage *storyMenuItemImagePressed = [UIImage imageNamed:@"GooglePlus.png"];
UIImage *starImage = [UIImage imageNamed:@"Mail-icon.png"];
starMenuItem1 = [[AwesomeMenuItem alloc]
initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
starMenuItem2 = [[AwesomeMenuItem alloc]
initWithImage:storyMenuItemImage
highlightedImage:storyMenuItemImagePressed
ContentImage:starImage
highlightedContentImage:nil];
// Now, setup the menu and the options
awesomeMenu = [[AwesomeMenu alloc]
initWithFrame:self.view.bounds
menus:[NSArray arrayWithObjects:starMenuItem1, starMenuItem2, nil]];
awesomeMenu.delegate = self;
NSLog(@"initializeSpringMenu: Done initializing it");
}
- (void)viewDidLoad {
...
[self initializeSpringMenu];
...
}
I think it’s pretty straightforward & I don’t see what am missing here. Is it the bounds when doing an ‘init’ of AwesomeMenu? Can someone please help? The view appears blank in the UI when I run the App.
Jean,
you need to add
AwesomeMenuto your ViewController’s view. Modify the end ofinitializeSpringMenuas follows:That should be all.