-
Notifications
You must be signed in to change notification settings - Fork 44
Home
pppoe edited this page Jun 13, 2011
·
4 revisions
Welcome to the LightMenuBar wiki!
-
Download the tarball, unzip it.
-
Drag the subfolder LightMenuBar into your project
-
Use LightMenuBar as a UIView
LightMenuBar *menuBar = [[LightMenuBar alloc] initWithFrame:CGRectMake(0, 20, 320, 40) andStyle:LightMenuBarStyleItem]; menuBar.delegate = self; [self.window addSubview:menuBar];
-
Refer to the bottom of file LightMenuBarAppDelegate.m to see the implementation of delegate. As least you implement three of them.
- (NSUInteger)itemCountInMenuBar:(LightMenuBar *)menuBar { return 6; } - (NSString *)itemTitleAtIndex:(NSUInteger)index inMenuBar:(LightMenuBar *)menuBar { return [@"BN" stringByAppendingFormat:@"%d", index]; } - (void)itemSelectedAtIndex:(NSUInteger)index inMenuBar:(LightMenuBar *)menuBar { dispLabel.text = [NSString stringWithFormat:@"%d Selected", index]; }
In my own project, I need two kinds of menu bar, so we have two styles here.
typedef enum {
LightMenuBarStyleItem, /**< After tapping on an item, the item is highlighted */
LightMenuBarStyleButton /**< When tapping on an item, the item is highlighted, after tapping, the item state changed to normal */
} LightMenuBarStyle;
For an item, after you select it, it keeps highlighted, while for a button, after you tap-and-release it comes back to its normal state.