dai*_*dai 6 iphone objective-c uitableview
我正在使用
- (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 @"";
}
Run Code Online (Sandbox Code Playgroud)
对于一组细胞的页脚.它工作得很好,但我想将文本对齐到左边(以帮助看起来).我知道你可以创建一个视图/ UILabel使用,viewForFooterInSection
但它似乎是一个丑陋的工作.有没有办法调整它?
tableView:viewForFooterInSection:
不是一个解决方法。
Apple 通常会为您提供两种选择:简单方式和手动方式。
如果简单的方法 ( tableView:titleForFooterInSection:
) 不能满足您的要求,您可以通过添加自己的视图来获得最大的灵活性。
事实上,你可以只返回一个 UILabeltableView:viewForFooterInSection:
应该超级简单。
如果你的tableview很短,那么你也可以写这样的东西:
-(void)viewDidLayoutSubviews
{
for (int section = 0; section < [self.tableView numberOfSections]; section++)
{
[self.tableView footerViewForSection:section].textLabel.textAlignment = NSTextAlignmentRight;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5586 次 |
最近记录: |