UITableView部分中的iOS7最后一个单元格强制使用全宽分隔符 [英] iOS7 last cell in UITableView section forces full width separator
问题描述
下面的 UITableView
有自定义 UITableViewCells
,我可以使用自定义<$中的这一行调整分隔符c $ c> UITableViewCell :
The UITableView
below has custom UITableViewCells
and I can adjust the separators fine using this line in the custom UITableViewCell
:
self.separatorInset = UIEdgeInsetsMake(0, kDefaultSeparatorLeftInset, 0, 0);
但是,该部分底部的单元格有一个默认分隔符,它会覆盖自定义我设置的UIEdgeInsets
。
However the cell at the bottom of the section has a default separator that overrides the custom UIEdgeInsets
that I set.
我希望所有分隔符的宽度相同,有没有办法在不重新绘制分隔符的情况下执行此操作?
I'd like all the separators to be the same width, is there any way of doing this without redrawing the separators manually?
推荐答案
经过一些实验,我发现唯一真正的解决方案是设置 UITableViewStyle
到 UITableViewStylePlain
并使用以下方式设置空页脚:
After some experimentation I've found the only real solution is to set the UITableViewStyle
to UITableViewStylePlain
and set empty footers using:
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
return [[UIView alloc] initWithFrame:CGRectZero];
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}
对于某些人来说这不是一个令人满意的解决方案,因为 UITableViewStylePlain
不提供 UITableViewStyleGrouped
的所有功能,但它给了我没有全宽分隔符的部分。
This will not be a satisfactory solution for some, because UITableViewStylePlain
does not provide all of the features of UITableViewStyleGrouped
, but it gives me the section without the full-width separator.
这篇关于UITableView部分中的iOS7最后一个单元格强制使用全宽分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!