Fah*_*kar 84 cocoa-touch uitableview ios
我有一个UITableView
,我只有3行,我可以看到这3行.问题是空单元格:我可以在那里看到线条.我不想看到那些台词.
知道如何删除这些线?
下面是我正在寻找的图像.
T. *_*sen 146
甚至比Andrey Z的回复更简单:只需在你的UITableView类中制作一个伪表tableFooterView:
self.tableFooterView = [UIView new]; // to hide empty cells
Run Code Online (Sandbox Code Playgroud)
和斯威夫特:
tableFooterView = UIView()
iPa*_*tel 88
您可以UITableView
使用以下任何一个代码片段隐藏标准分隔线.添加自定义分隔符的最简单方法是添加UIView
1px高度的简单:
UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 1)];
separatorLineView.backgroundColor = [UIColor clearColor]; // set color as you want.
[cell.contentView addSubview:separatorLineView];
Run Code Online (Sandbox Code Playgroud)
要么
self.tblView=[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,370) style:UITableViewStylePlain];
self.tblView.delegate=self;
self.tblView.dataSource=self;
[self.view addSubview:self.tblView];
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 10)];
v.backgroundColor = [UIColor clearColor];
[self.tblView setTableHeaderView:v];
[self.tblView setTableFooterView:v];
[v release];
Run Code Online (Sandbox Code Playgroud)
要么
- (float)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
// This will create a "invisible" footer
return 0.01f;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
// To "clear" the footer view
return [[UIView new] autorelease];
}
Run Code Online (Sandbox Code Playgroud)
要么
并且还检查了nickfalk的答案,它非常简短且有用.你也应该尝试这一行,
self.tableView.tableFooterView = [[UIView alloc] init];
Run Code Online (Sandbox Code Playgroud)
不确定,但它适用于我检查的所有iOS版本,iOS 5及更高版本,最高可达iOS 7.
更新了swift和iOS 9的答案.这适用于.Plain
各种各样的表格视图.
tableView.tableFooterView = UIView()
Run Code Online (Sandbox Code Playgroud)
透明UIView
作为tableView
1px高度的页脚将成功.
UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 1)];
v.backgroundColor = [UIColor clearColor];
[self.tableView setTableFooterView:v];
Run Code Online (Sandbox Code Playgroud)
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
60814 次 |
最近记录: |