Last active
December 20, 2015 10:31
-
-
Save UjwalManjunath/6115839 to your computer and use it in GitHub Desktop.
adding a custom Header( UIlabel )to a UItableview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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