iPhone table header lables not showing up in Release build but show up OK in Debug build

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-05-07T20:55:45Z Indexed on 2010/05/07 20:58 UTC
Read the original article Hit count: 266

Filed under:

My table header shows up ok with Release build or Debug build for the iPhone simulator, but the header labels only show up with debug build on the iPhone. No header labels show up on the iPhone for release build.

Any ideas?

Thanks, Robert

My code for the header is below

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)sectionNum
{

@try {

// create the parent view that will hold header Label UIView* customView = [[[UIView alloc] initWithFrame:CGRectMake(HEADER_RELX_OFFSET, HEADER_RELY_OFFSET, HEADER_ROW_WIDTH, HEADER_HEIGHT)] autorelease]; UILabel* headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];

headerLabel.backgroundColor = [UIColor clearColor]; headerLabel.opaque = NO; headerLabel.numberOfLines = 0; headerLabel.textColor = [UIColor blackColor]; headerLabel.highlightedTextColor = [UIColor whiteColor]; headerLabel.font = [UIFont boldSystemFontOfSize:HEADER_FONT_SIZE]; headerLabel.textAlignment = UITextAlignmentCenter; headerLabel.lineBreakMode = UILineBreakModeWordWrap; headerLabel.frame = CGRectMake(HEADER_RELX_OFFSET, HEADER_RELY_OFFSET, HEADER_ROW_WIDTH, HEADER_HEIGHT);

if(sectionNum == 0) headerLabel.text = @"My Label"; else headerLabel.text = @"";

[customView addSubview:headerLabel];
return customView;

@catch (NSException* exception) {
NSLog(@"viewForHeaderInSection: %@: %@",[exception name],[exception reason]);
} }

© Stack Overflow or respective owner

Related posts about iphone-sdk-3.0