// // Toolview.m // Lighting // // Created by 曹云霄 on 16/4/27. // Copyright © 2016年 上海勾芒科技有限公司. All rights reserved. // #import "Toolview.h" #import "CustomButton.h" @implementation Toolview /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundColor = kTCColor(239, 239, 239); [self uiConfigAction]; } return self; } #define ButtonWIDTH 100 //按钮宽度 #define Buttoninterval 20//按钮间隔 #define ButtonRIGHT 54//按钮高度 #pragma mark -布局 - (void)uiConfigAction { for (int i=1; i<5; i++) { CustomButton *button = [CustomButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(ScreenWidth-(i*ButtonWIDTH + Buttoninterval*(i-1)), 10, ButtonWIDTH, ButtonRIGHT); [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [button setTitle:@"购物车" forState:UIControlStateNormal]; [button setImage:TCImage(@"qq") forState:UIControlStateNormal]; [self addSubview:button]; } } @end