分页切换控制器

作者: 晨阳聊电影 | 来源:发表于2017-01-09 19:04 被阅读990次
项目截图
!!!!!!!之前下载的,可能遇到滑动,页面变白,已修复,重新下载这个第三方库!!!

今天做项目,遇到这个需求,有这上面四种状态,我之前在cocochina逛的时候,我记得很多类似的demo,但是今天找了,没一个合适的,在群里问朋友,朋友给我发了一个这种的第三方,用着很方便,只有继承一下就行了,上面的文字颜色,大小,选中文字的大小和颜色还有下面的条的宽度和颜色都可以通过属性改变!!!话不多说,直接发一个github上面的链接https://github.com/changjianfeishui/XBScrollPageController

Paste_Image.png

只把这几个类拖到自己的工程就行了,自己建一个类,继承它就行了,这个类里面代码如下

#import "PublishListViewController.h"
#import "DconfirmedViewController.h"
#import "DprocessedViewController.h"
#import "ServiceViewController.h"
#import "CompletedViewController.h"

#define TAG_WIDTH (SCREEN_WIDTH / 4)

@interface PublishListViewController ()<UIScrollViewDelegate>

@end

@implementation PublishListViewController

-(instancetype)init
{
    if (self = [super initWithTagViewHeight:45]) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"我的接取";
 
    self.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTranslucent:NO];
    
    NSArray *titleArray = @[@"待确认",@"待服务",@"服务中",@"已完成"];
    self.tagItemSize = CGSizeMake(SCREEN_WIDTH, 45);
    //将你需要的控制器添加到这里面
    NSArray *classArray = @[[DconfirmedViewController class],[DprocessedViewController class],[ServiceViewController class],[CompletedViewController class]];
    
    self.normalTitleFont = [UIFont systemFontOfSize:16];///**< 正常(非选中)标签字体  default is 14*/
    self.selectedTitleFont = [UIFont systemFontOfSize:16];/**< 选中状态标签字体  default is 16*/
    self.normalTitleColor = kColorRGB(0x3d3d3d); /**< 正常(非选中)标签字体颜色  default is darkGrayColor*/

    self.selectedTitleColor = kColorRGB(0x0ed4b5);/**< 选中状态标签字体颜色  default is redColor*/
    self.selectedIndicatorColor = kColorRGB(0x0ed4b5);
    self.selectedIndicatorSize = CGSizeMake(54, 2);/**< 下方滑块颜色 default is redColor*/
    self.tagItemSize = CGSizeMake(TAG_WIDTH, 45); /**< 每个tag标签的size,如果不设置则会根据文本长度计算*/
    
    [self reloadDataWith:titleArray andSubViewdisplayClasses:classArray];
   
}

好了,真的挺好用的!!!

相关文章

网友评论

    本文标题:分页切换控制器

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