Skip to content

visoon/WXScrollMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

WXScrollMenu

Cyclic scroll menu.

Preview gif

image

Usage

init

    NSMutableArray *buttonArr = [NSMutableArray array];
    NSMutableArray *colorArr = [NSMutableArray array];
    UIColor *color0 = [UIColor colorWithRed:89 / 255.0 green:204 / 255.0 blue:62 / 255.0 alpha:1];
    UIColor *color1 = [UIColor colorWithRed:0 / 255.0 green:207 / 255.0 blue:219 / 255.0 alpha:1];
    UIColor *color2 = [UIColor colorWithRed:255 / 255.0 green:100 / 255.0 blue:105 / 255.0 alpha:1];
    UIColor *color3 = [UIColor colorWithRed:255 / 255.0 green:176 / 255.0 blue:76 / 255.0 alpha:1];
    UIColor *color4 = [UIColor colorWithRed:129 / 255.0 green:225 / 255.0 blue:73 / 255.0 alpha:1];
    UIColor *color5 = [UIColor colorWithRed:243 / 255.0 green:206 / 255.0 blue:67 / 255.0 alpha:1];
    
    NSArray *titles = @[@"标题1", @"这里是标题2", @"标题3", @"这里是标题4", @"这里是标题5", @"这里是标题6"];
    [colorArr addObjectsFromArray:@[color0, color1, color2, color3, color4, color5]];
    for (int i = 0; i < titles.count; i ++) {
        TabButton *t = [[TabButton alloc] initWithBackgroundColor:colorArr[i] title:titles[i]];
        [buttonArr addObject:t];
    }
    _segmentedView = [[DFSTSegmentedView alloc] initWithFrame:CGRectMake(0, 100, [UIScreen mainScreen].bounds.size.width, 50) buttons:buttonArr defaultIndex:_defaultIndex];
    _segmentedView.delegate = self;
    [self.view addSubview:_segmentedView];

call back with delegate

- (void)didSuccessScrollToIndex:(NSInteger)index {
    NSLog(@"currentIndex = %d", index);
}

others

/**
 *  根据进度滚动到index
 *
 *  @param index    序号
 *  @param progress progress范围 0.0~1.0
 */
- (void)scrollToIndex:(NSInteger)index progress:(float)progress;

/**
 *  滚动到index  采用动画
 *
 *  @param index
 */
- (void)scrollToIndex:(NSInteger)index;

About

A colourful menu bar !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published