A custom horizontal scroll menu
pod ‘MinScrollMenu’
- create a MinScrollMenu on storyboard.
- drag the IBOutlet of MinScrollMenu to you controller.
- set the delegate property to the controller,
like this:
_menu.delegate = self;
_menu = [[MinScrollMenu alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
_menu.delegate = self;
[self.view addSubview:_menu];
- Require to realization 3 protocol methods:
- (NSInteger)numberOfMenuCount:(MinScrollMenu *)menu;
- (CGFloat)scrollMenu:(MinScrollMenu *)menu widthForItemAtIndex:(NSInteger)index;
- (MinScrollMenuItem *)scrollMenu:(MinScrollMenu *)menu itemAtIndex:(NSInteger)index;
-
Xib or storyboard create MinScrollMenuItem is not supported
-
If the menu content size is not correct. Add this code for your controller:
self.automaticallyAdjustsScrollViewInsets = NO;