-
Notifications
You must be signed in to change notification settings - Fork 0
/
CCSegmentBar.h
46 lines (34 loc) · 1.04 KB
/
CCSegmentBar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// CCSegmentBar.h
// CCSegmentBar
//
// Created by coderchou on 2016/11/26.
// Copyright © 2016年 coderchou. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CCSegmentBarConfig.h"
@class CCSegmentBar;
@protocol CCSegmentBarDelegate <NSObject>
/**
代理方法, 告诉外界, 内部的点击数据
@param segmentBar segmentBar
@param toIndex 选中的索引(从0开始)
@param fromIndex 上一个索引
*/
- (void)segmentBar: (CCSegmentBar *)segmentBar didSelectIndex: (NSInteger)toIndex fromIndex: (NSInteger)fromIndex;
@end
@interface CCSegmentBar : UIView
/**
快速创建一个选项卡控件
@param frame frame
@return 选项卡控件
*/
+ (instancetype)segmentBarWithFrame: (CGRect)frame;
/** 代理 */
@property (nonatomic, weak) id<CCSegmentBarDelegate> delegate;
/** 数据源 */
@property (nonatomic, strong) NSArray <NSString *>*items;
/** 当前选中的索引, 双向设置 */
@property (nonatomic, assign) NSInteger selectIndex;
- (void)updateWithConfig: (void(^)(CCSegmentBarConfig *config))configBlock;
@end