Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 30, 2011, 07:49 PM   #1
ljg93
Banned
 
Join Date: Mar 2011
Translucent Sectioned Table View Header

Hello,

I have been looking for the line of code that would turn the sectioned table view headers to appear translucent, heres a code snippet.

Code:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    self.tableView.sectionHeaderHeight = 40;
    NSString *title = nil;
    // Return a title or nil as appropriate for the section.
    
    switch (section) {
        case 0:
            title = @"Row 1";
            break;
        case 1:
            title = @"Row 2";
            break;
        case 2:
            title = @"Row 3";
            break;
        default:
            break;
    }
    
    UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 35)];
    
    UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(1,3, tableView.bounds.size.width - 1,35)] autorelease];
    label.text = title;
    label.textColor = [UIColor blackColor];
    label.font = [UIFont fontWithName:@"Arial-BoldMT" size:14];
    label.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"section_bar_blue.png"]];;

    [v addSubview:label];
    //[UIColor colorWithPatternImage:[UIImage imageNamed:@"section_bar_green.png"]];;
    return v;
}
ljg93 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iOS 7 translucent view controller Why?????? iPhone/iPad Programming 1 Dec 6, 2013 02:59 PM
View-based table view losing selection highlight Starfox Mac Programming 1 Nov 28, 2012 02:02 AM
Find location of table view cell that calls view controller moonman239 iPhone/iPad Programming 3 Nov 24, 2012 06:31 PM
View based table view layout woes Starfox Mac Programming 0 Nov 8, 2012 11:50 PM
Pushing to a Detail View from a Table View Cell using Xcode Storyboard xcodeApp10 iPhone/iPad Programming 2 Sep 17, 2012 04:45 PM

Forum Jump

All times are GMT -5. The time now is 06:13 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC