我们在项目中,UITablview 已经是我们必用的一个控件,有时候需要在 UITablview 上加一个header,直接上图
-(void)initView{
_headerView = [[TableHeaderSelectView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, 40)];
NSArray *tabBarItemTitles = @[@"进行中", @"即将开始",@"已结束"];
[_headerView setMatch:true];
[_headerView setDelegate:self];
[_headerView setData:tabBarItemTitles];
[self.view addSubview:_headerView];
}
#pragma mark - TableHeaderSelectViewDelegate
- (void)selectedIndex:(NSInteger)index{
NSLog(@"select index is %ld",index);
}