#pragma mark- TableView Delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;
}
- (CGFloat)tableView:(UITableView* )tableView heightForRowAtIndexPath:(NSIndexPath* )indexPath{
return 55;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentity = @"registerCellId";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentity];
UILabel *name=[[UILabel alloc]initWithFrame:CGRectMake(15, 15, K_SCREEN_WIDTH/4, 25)];
UIButton *btn =[[UIButton alloc]initWithFrame:CGRectMake(15+K_SCREEN_WIDTH/4, 15, 50, 25)];
UIButton *btn1 =[[UIButton alloc]initWithFrame:CGRectMake(15+(K_SCREEN_WIDTH/4)*2, 15, 50, 25)];
UIButton *btn2 =[[UIButton alloc]initWithFrame:CGRectMake(15+(K_SCREEN_WIDTH/4)*3, 15, 50, 25)];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentity];
name.font=[UIFont systemFontOfSize:14];
name.textColor=[UIColor blackColor];
btn.tag=6666+indexPath.row;
btn1.tag=7777+indexPath.row;
btn2.tag=8888+indexPath.row;
[btn addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];
[btn1 addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];
[btn2 addTarget:self action:@selector(btn:) forControlEvents:UIControlEventTouchDown];
[btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
[btn1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
[btn2 setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
// [btn3 setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[cell.contentView addSubview:name];
[cell.contentView addSubview:btn];
[cell.contentView addSubview:btn1];
[cell.contentView addSubview:btn2];
// [cell.contentView addSubview:btn3];
}
name.text=@"陈陈陈";
[btn setTitle:@"1" forState:UIControlStateNormal];
[btn1 setTitle:@"1" forState:UIControlStateNormal];
[btn2 setTitle:@"1" forState:UIControlStateNormal];
// [btn3 setTitle:@"1" forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (void)btn:(UIButton*)sender
{
NSLog(@"%ld",sender.tag);
}