gpt4 book ai didi

iphone - 对齐 UITableView 的页脚中的文本

转载 作者:太空狗 更新时间:2023-10-30 03:42:06 27 4
gpt4 key购买 nike

我在用

- (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 @"";
}

用于一组单元格的页脚。效果很好,但我想将文本左对齐(以帮助外观)。我知道您可以使用 viewForFooterInSection 创建 View /UILabel,但这似乎是一个丑陋的解决方法。有什么办法可以对齐吗?

最佳答案

tableView:viewForFooterInSection: 不是解决方法。

Apple 通常会为您提供两种选择,简单方式和手动方式。

如果简单的方法 (tableView:titleForFooterInSection:) 不能满足您的要求,您可以通过添加自己的 View 来获得最大的灵 active 。

事实上,你可以在 tableView:viewForFooterInSection: 中返回一个 UILabel

应该 super 简单。

关于iphone - 对齐 UITableView 的页脚中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5150378/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com