UITableViewHeaderFooterView can't change custom background when loading
from nib
I've created a custom UITableViewHeaderFooterView and successfully load
from nib into my UITableView but always get this message
"Setting the background color on UITableViewHeaderFooterView has been
deprecated. Please use contentView.backgroundColor instead."
Here the code for loading my custom UITableViewHeaderFooterView:
- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section {
KTHeaderFooterViewIphone customHeaderIphone* = [[[NSBundle mainBundle]
loadNibNamed:@"KTHeaderFooterViewIphone" owner:self options:nil]
objectAtIndex:0];
customHeaderIphone.tintColor = [UIColor whiteColor]; // this code
worked, but the message above always show
customHeaderIphone.contentView.backgroundColor = [UIColor redColor];
// this code doesn't work, nothing's happened
customHeaderIphone.contentView.backgroundColor = [UIColor
colorWithPatternImage:[UIImage imageNamed:@"customHeader.png"]]; //
this code doesn't work too, I can't change custom background image
return customHeaderIphone;
}
No comments:
Post a Comment