Skip to content

Instantly share code, notes, and snippets.

@UjwalManjunath
Last active December 20, 2015 10:31
Show Gist options
  • Save UjwalManjunath/6115839 to your computer and use it in GitHub Desktop.
Save UjwalManjunath/6115839 to your computer and use it in GitHub Desktop.
adding a custom Header( UIlabel )to a UItableview
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc ]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, tableView.frame.size.width, 18)];
[label setFont:[UIFont boldSystemFontOfSize:12]];
NSString *string =@"Enter Email Address";
/* Section header is in 0th index... */
[label setText:string];
view.backgroundColor = [UIColor clearColor];
label.backgroundColor = [UIColor clearColor];
[view addSubview:label];
return view;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment