Skip to content
pppoe edited this page Jun 13, 2011 · 4 revisions

Welcome to the LightMenuBar wiki!

What it looks

Menu Bar

How to use it

  1. Download the tarball, unzip it.

  2. Drag the subfolder LightMenuBar into your project

  3. Use LightMenuBar as a UIView

     LightMenuBar *menuBar = [[LightMenuBar alloc] initWithFrame:CGRectMake(0, 20, 320, 40) andStyle:LightMenuBarStyleItem];
     menuBar.delegate = self;
     [self.window addSubview:menuBar];
    
  4. 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];
     }
    

Miscellaneous

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.

Clone this wiki locally