I'm using
- (NSString *)tableView:(UITableView *)tv titleForFooterInSection:(NSInteger)section
{
if (section == 1)
{
return @
"Some text \r\n"
"\r\n"
"1. Point 1\r\n "
"2. Point 2\r\n"
"3. Point 3";
}
return @"";
}
for the footer of a group of cells. It works great, but I want to align the text to the left (to help the look). I know you can create a view / UILabel using viewForFooterInSection
but it seems an ugly work around. Is there any way to align it?
tableView:viewForFooterInSection:
is not a workaround.
It's common for Apple to give you two options, the easy way and the manual way.
If the easy way (tableView:titleForFooterInSection:
) isn't doing what you want, you have the ultimate in flexibility by adding your own view.
In fact, you can just return a UILabel in tableView:viewForFooterInSection:
Should be super easy.
if your tableview is short, then you can also write something like this:
-(void)viewDidLayoutSubviews
{
for (int section = 0; section < [self.tableView numberOfSections]; section++)
{
[self.tableView footerViewForSection:section].textLabel.textAlignment = NSTextAlignmentRight;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With