/ Published in: iPhone
This sinpet is extracted from a post of "Undefined Value", Kris Johnson's Blog.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { if (sectionTitle == nil) { return nil; } // Create label with section title UILabel *label = [[[UILabel alloc] init] autorelease]; label.frame = CGRectMake(20, 6, 300, 30); label.backgroundColor = [UIColor clearColor]; label.textColor = [UIColor colorWithHue:(136.0/360.0) // Slightly bluish green saturation:1.0 brightness:0.60 alpha:1.0]; label.shadowColor = [UIColor whiteColor]; label.shadowOffset = CGSizeMake(0.0, 1.0); label.font = [UIFont boldSystemFontOfSize:16]; label.text = sectionTitle; // Create header view and add label as a subview UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, SectionHeaderHeight)]; [view autorelease]; [view addSubview:label]; return view; }