您的当前位置:首页正文

返回局部变量的值

来源:要发发知识网

先看一段demo的代码,这个一个好友列表部分代码,设置每个session的头标题为button

//设置组的头视图

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIButton * button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor cyanColor];
    [button setTitle:[NSString stringWithFormat:@"第%ld组",section] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonAC:) forControlEvents:UIControlEventTouchUpInside];
    button.tag = section;
    return button;
}