Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIView *customTitleView = [ [UIView alloc] initWithFrame:CGRectMake(10, 0, 300, 44)];
- UILabel *titleLabel = [ [UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
- titleLabel.text = @"<Title string here>";
- titleLabel.textColor = [UIColor whiteColor];
- titleLabel.backgroundColor = [UIColor clearColor];
- [customTitleView addSubview:titleLabel];
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- UIView *customTitleView = [ [UIView alloc] initWithFrame:CGRectMake(10, 0, 300, 44)];
- UILabel *titleLabel = [ [UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
- titleLabel.text = @"<Title string here>";
- titleLabel.textColor = [UIColor whiteColor];
- titleLabel.backgroundColor = [UIColor clearColor];
- [customTitleView addSubview:titleLabel];
- return customTitleView;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 44;
- }
- -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
- if (sectionTitle == nil) {
- return nil;
- }
- UILabel *label = [[UILabel alloc] init];
- label.frame = CGRectMake(20, 8, 320, 20);
- label.backgroundColor = [UIColor clearColor];
- label.textColor = [UIColor whiteColor];
- label.shadowColor = [UIColor grayColor];
- label.shadowOffset = CGSizeMake(-1.0, 1.0);
- label.font = [UIFont boldSystemFontOfSize:16];
- label.text = sectionTitle;
- UIView *view = [[UIView alloc] init];
- [view addSubview:label];
- return view;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
Add Comment
Please, Sign In to add comment