views:

364

answers:

3

Guys-

I am using

- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
  if ( section == 0 )
  {
    return NSLocalizedString(@"Section_0_text", @"");
  }
  if ( section == 1 )
  {
    return NSLocalizedString(@"Section_1_text","");
  }
  return nil;  
}

Can I modify return string text font, color and other few properties?

+1  A: 

Use the following to return your own view with custom text color etc.

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
willi
+2  A: 

Take a look at the UITableViewDelegate class, specifically the methods tableView:viewForFooterInSection: and tableView:heightForFooterInSection:. You can return whatever kind of view you'd like, including--but not limited to--a UILabel with whatever text properties you want.

Sixten Otto
This solution worked. I had to also implement tableView:heightForFooterInSection. Thanks
iamiPhone
+1  A: 

To expand upon what willi said, keep in mind that this doesn't need to be a complicated custom view or anything. You can return a simple UILabel object all styled with your fonts and colors, and that will work fine. In fact, it's how Apple's API docs recommend you accomplish this.

The table view uses a fixed font style for section footer titles. If you want a different font style, return a custom view (for example, a UILabel object) in the delegate method tableView:viewForFooterInSection: instead.

Marc W
First i implemented this, but i am facing a problem with this. I've two section and both the sections have footer and if i implemented using UIlable then footer is not shown as it should be. UILable is drawn on top of my second section, And i don't know how to move second section's Y location.
iamiPhone