美文网首页
分页button

分页button

作者: WinsonCheung | 来源:发表于2016-11-10 20:51 被阅读21次

    在自己的项目中频繁遇到分页button, 类似下图:

    PageButtonView.gif

    简单封装一个, 适合新手学习和使用, 代码地址:
    PageButtonView

    使用方法如下:

    PageButtonView *pageButtonView = ({
            pageButtonView = [[PageButtonView alloc]initWithFrame:CGRectMake(0, 20, screen_width, 40) buttonTitles:buttonTitles];
            pageButtonView.backgroundColor = [UIColor groupTableViewBackgroundColor];
            pageButtonView.normalButtonColor = [UIColor grayColor];
            pageButtonView.selectedButtonColor = [UIColor redColor];
            pageButtonView.selectedLineColor = [UIColor blueColor];
            pageButtonView.selectedIndex = nextButton;
            pageButtonView.buttonTouchedBlock = ^(NSInteger index) {
                NSLog(@"点击了或选中了button%ld", (long)index);
            };
            pageButtonView;
        });
        [self.view addSubview:pageButtonView];
    

    若有问题, 欢迎一起学习 一起成长~

    相关文章

      网友评论

          本文标题:分页button

          本文链接:https://www.haomeiwen.com/subject/ulbxpttx.html