Subject: Tighter and fresh-faced w/out a knife

From: The 24-Hour Facelift <[email-masked]>
Date: Wed, 19 Nov 2014 10:58:36 -0800

Anti-AgingONDocOz

In Depth: The 24-Hour Facelift

Anti-Aging| Published November 19, 2014 | DocOz Blog

This episode shows the "No-Knife" facelift with results after 24hrs.

You skipped out on the sunscreen, you wear your frustration on your forehead and want the skin you had 10 yrs ago.

We respect the fact that our viewers want a fresh-faced look without going through all the "birthing pains".

Your busy, and in reality the fine lines are already showing up and it's time for an intervention with a quick turn-around.

Learn More Here >

Subscription Maintenance w/ FBS Members Inc 125 Sheridan St Newcastle, WY 82701 or Unsubscribe Here

I created a custom xib file that has a small UIView used for a custom table section header. I classed the custom xib file.

I want to add this to faaab5d0-ea5f-4225-891b-a6193ab703fc a tableView as the header. I have looked at a few resources, but they seem to be either outdated or missing information.

Looking in the documentation, I see a reference to adding a custom header with the following instructions:

To make the table view aware of your header or footer view, you need to register it. You do this using the registerNib:forCellReuseIdentifier: or registerClass:forCellReuseIdentifier: method faaab5d0-ea5f-4225-891b-a6193ab703fc of UITableView.

When I added a tableView to my storyboard view, it was easy faaab5d0-ea5f-4225-891b-a6193ab703fc to assign it a reuse identifier within XCode. I was even able to create a custom faaab5d0-ea5f-4225-891b-a6193ab703fc cell xib file and it also had a spot for a reuse identifier within XCode.

When I created the custom UIView for the section header, it did not have an entry for reuse identifier. Without this, I have no idea how to use registerNib:forCellReuseIdentifier.

More information: I have a storyboard scene that has a tableView inside. The tableView is of a custom class that is linked and the faaab5d0-ea5f-4225-891b-a6193ab703fc tableView object has an outlet in the parent view's ViewController file.

The parent ViewController is both the UITableViewDataSourceDelegate and UITableViewDelegate. Again, I was able to implement the custom cells with no issue. I can't even modify the header in any way besides the title.

I tried calling the method [[self tableHeaderView] setBackgroundColor:[UIColor clearColor]]; from the custom tableView class and nothing happens. I tried using this method in the parent ViewController class by using the outlet name like so: [[self.tableOutlet tableHeaderView] setBackgroundColor:[UIColor clearColor]];

Any help would be greatly appreciated.

EDIT: (Can't change background to transparent)

- (UIView *)tablefaaab5d0-ea5f-4225-891b-a6193ab703fcView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

HeaderView *headerView = [self.TableView dequeueReusableHeaderFooterViewWithIdentifier:@"tableHeader"];

// Set Background color

[[headerView contentView] setBackgroundColor:[UIColor clearColor]];

// Set Text

headerView.headerLabel.text = [self.sectionArray objectAtIndex:section];

return headerView;

}

ios

share|improve this question

edited Janfaaab5d0-ea5f-4225-891b-a6193ab703fc 30 '13 at 16:01

asked Jan 28 '13 at 20:59

orbv12

168317

add a comment

1 Answer

activeoldestvotes

up vote

10

down vote

accepted faaab5d0-ea5f-4225-891b-a6193ab703fc

You don't need to set the identifier in the xib -- you just need to use the same identifier when you register, and when you dequeue the header view. In the viewDidLoad method, I registered the view like this:

[self.tableView registerNib:[UINib nibWithNibName:@"Header1" bundle:nil] forHeaderFooterViewReuseIdentifier:@"header1"];

Then, in the delegate methods:

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

UIView *headerView = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:@"header1"];

return headerView;

}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

return 100;

}

share|improve this answer

answered Jan 28 '13 at 21:43

rdelmar

54.3k54884

I implemented this and it seems to work, but the background for the header is still the default style. I am able to use the label I placed in my custom xib file to change the text of the header. I have the label as an outlet in the header's class files (CustomHeader.h, CustomHeader.m). orbv12 Jan 30 '13 at 15:08 faaab5d0-ea5f-4225-891b-a6193ab703fc

1

@orbv, you have to use headerView.contentView.backgroundColor = ... to change the background color. rdelmar Jan 30 '13 at 15:39

I tried inserting that faaab5d0-ea5f-4225-891b-a6193ab703fc and it still stays the same. Again, setting the custom label text works great. I posted the code snippet in an edit. orbv12 Jan 30 '13 at 16:00

1

@orbv, that's because the default header view also has a backgroundView property with that look, so you can see through to it if your color is clear. If you add, headerView.backgroundView = [[UIView faaab5d0-ea5f-4225-891b-a6193ab703fc alloc]initWithFrame:headerView.frame]; you will put in a new clear view@orbv, yes, there is a separate table header that scrolls up with the table view. It doesn't stick to the top like the section headers. rdelmar Jan 30 '13 at 16:20