GMCategaryBar.h 2.98 KB
//
//  SBCategaryBar.h
//  GomeEShop
//
//  Created by tangli on 15/3/10.
//  Copyright (c) 2015年 Gome. All rights reserved.
//

#import <UIKit/UIKit.h>



#define  Padding  15

#define DIVIDER_W 76

#define screenH   ([UIScreen mainScreen].bounds.size.height)
#define screenW   ([UIScreen mainScreen].bounds.size.width)

///* 分类bar的高度 */
#define CATEGARYBAR_H (40)

/// NavBar 的高度
#define GMK_NavBar_H (58)

#define FounSize (15)

/// 通过RGBA设置颜色,使用0x格式,如:RGBAAllColor(0xAABBCC, 0.5);
#define RGBAAllColor(rgb, a) [UIColor colorWithRed:((float)((rgb & 0xFF0000) >> 16))/255.0  \
                                             green:((float)((rgb & 0xFF00) >> 8))/255.0     \
                                              blue:((float)(rgb & 0xFF))/255.0              \
                                             alpha:(a)/1.0]

/// 通过RGB设置颜色,使用0x格式,如:RGBAAllColor(0xAABBCC);
#define RGBAllColor(rgb) RGBAAllColor(rgb, 1.0)

/// 通过RGBA设置颜色,支持10位和16位,使用16位时每个色值前加0x,系统会默认16进制
#define RGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0  \
                                              green:(g)/255.0  \
                                               blue:(b)/255.0  \
                                              alpha:(a)/1.0]

/// 通过RGB设置颜色,支持10位和16位,使用16位时每个色值前加0x,系统会默认16进制
#define RGBColor(r, g, b) RGBAColor(r, g, b, 1.0)

@class GMCategaryBar;

@protocol GMCategaryBarDelegate <NSObject>

@optional

/*!
 *  @Author tangli, 15-03-05 18:03:41
 *
 *  @brief  点击分类Bar上的标签按钮时的代理方法
 *
 *  @index  点击分类Bar上的标签按钮的索引(以0开始)
 *
 *  @since  4.0.8
 */
- (void)categaryBarOptionalDelegate:(GMCategaryBar *)categaryBar withBtnIndex:(NSInteger)index;

@end

/*!
 *  @Author tangli, 15-03-31 15:03:07
 *
 *  @brief  封装上面的分类选项卡
 *
 *  @since  4.0.8
 */
@interface GMCategaryBar : UIScrollView


// 由于UIScrollView有了一个代理为delegate,因此代理名不能为delegate
@property (nonatomic, weak) id<GMCategaryBarDelegate> delegateCategary;

/*!
 *  @Author tangli, 15-03-05 18:03:41
 *
 *  @brief  初始化变量
 *
 *  @array  标签文字数组
 *
 *  @isEqualBtn  初始化红线的X值是否等于0(yes为定于0)
 *
 *  @return  返回分类分类导航栏对象
 *
 *  @since   4.0.8
 */
+ (instancetype)categaryBarWithArrayTitle:(NSArray *)ary dividerIsEqualBtnW:(BOOL)isEqualBtn;

/*!
 *  @Author tangli, 15-03-05 18:03:41
 *
 *  @brief  当滑动底下的View时,分类bar中的标签按钮下的红线也会自动滑动
 *
 *  @array  滑向标签按钮的索引(以0开始)
 *
 *  @since   4.0.8
 */
- (void)automaticScrollDivider:(NSInteger)intIndex;

/*!
 *  @Author tangli, 15-03-05 18:03:41
 *
 *  @brief  删除按钮
 *
 *  @index  删除按钮的索引
 *
 *  @since   4.0.8
 */
- (void)deleteBtnWithIndex:(NSInteger)intIndex;

@end