// // SelecterToolsScrolView.m // SelecterTools // // Created by zhao on 16/3/15. // Copyright © 2016年 xincheng. All rights reserved. // #import "SelecterToolsScrolView.h" #define WIDTH [UIScreen mainScreen].bounds.size.width #define HEIGHT [UIScreen mainScreen].bounds.size.height #define TitleFont 15 @interface SelecterToolsScrolView() @property(nonatomic,copy)BtnClick btnClick; @property(nonatomic,retain)NSMutableArray *btnArr; @property(nonatomic,retain)UIButton * previousBtn; @property(nonatomic,retain)UIButton * currentBtn; @property(nonatomic,retain)UIView *bottomScrLine; @end @implementation SelecterToolsScrolView /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ -(instancetype)initWithSeleterConditionTitleArr:(NSArray *)titleArr andBtnBlock:(BtnClick)btnClick { self = [super init]; if (self) { self.frame = CGRectMake(-1,NavHeader,WIDTH-40, 40); self.backgroundColor = NewThemeColor; _btnArr = [NSMutableArray array]; for (int i = 0; iself.contentSize.width-((WIDTH/2)-20)) { [self setContentOffset:CGPointMake(self.contentSize.width-(WIDTH-40), 0) animated:YES]; }else { [self setContentOffset:CGPointMake(btn.center.x-((WIDTH/2)-20), 0) animated:YES]; } } // //-(CGFloat)getTitleContentWidth:(NSString *)title //{ // CGRect rect = [title boundingRectWithSize:CGSizeMake(WIDTH, 30) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:TitleFont]} context:nil]; // return rect.size.width; //} @end