// // InputView.m // jiaPei // // Created by apple on 16/1/7. // Copyright © 2016年 JCZ. All rights reserved. // #import "InputView.h" @implementation InputView -(id)initWithTitle:(NSString*)title{ self = [super initWithFrame:kFrame]; [self setBackgroundColor:[UIColor colorWithWhite:.3 alpha:.6]]; if (self) { CGFloat x,y,w,h,bd; w = 280; x = (kSize.width - w)/2.0; y=0; h = 120; UIView* cv = [[UIView alloc] initWithFrame:CGRectMake(x, y, w, h)]; [cv setBackgroundColor:backGroundColor]; // [self addSubview:cv]; cv.center = CGPointMake(kSize.width/2.0, kSize.height/2.0-kNavOffSet); cv.layer.cornerRadius = 10; cv.layer.masksToBounds = YES; [cv setClipsToBounds:YES]; contentVi = cv; UILabel* label; int num = 4; int cnt = 10; bd = 15; h = (contentVi.width - (num+1)*bd)/num; x=0; y=0; // w=w; // h=30; label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)]; [label setBackgroundColor:RQ_MAIN_COLOR]; [label setTextColor:[UIColor whiteColor]]; [label setText:title]; [label setTextAlignment:NSTextAlignmentCenter]; [cv addSubview:label]; UIButton* btn; NSInteger tag=0; bd = 10; w = h; x = cv.width - bd - w; btn = [[UIButton alloc] initWithFrame:CGRectMake(x, y, w, h)]; [btn setTitle:@"×" textColor:[UIColor whiteColor] Font:30 fotState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; [cv addSubview:btn]; [btn setTag:tag++]; //port 1 -10 num = 4; cnt = 10; bd = 15; w = (contentVi.width - (num+1)*bd)/num; y+= h + bd; h = w; for (int i = 0; i