Ios 如何删除顶部UITableView上的灰线
初始化UIViewController代码:Ios 如何删除顶部UITableView上的灰线,ios,uitableview,Ios,Uitableview,初始化UIViewController代码: self.view.backgroundColor= [UIColor whiteColor]; CGSize boundsSize = self.view.bounds.size; CGRect rectTableViewFrame = CGRectMake(0, 0, boundsSize.width, boundsSize.height - 64); UITableView* contentTableView =
self.view.backgroundColor= [UIColor whiteColor];
CGSize boundsSize = self.view.bounds.size;
CGRect rectTableViewFrame = CGRectMake(0, 0, boundsSize.width, boundsSize.height - 64);
UITableView* contentTableView = [[UITableView alloc] initWithFrame:rectTableViewFrame];
contentTableView.backgroundColor = [UIColor clearColor];
contentTableView.separatorColor = [UIColor clearColor];
contentTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
下一个加载项UITableView自定义视图(标题):
问题:滚动contentTableView时,顶部的customView有一条灰线。。。如何删除此项?
我不使用以下方法:
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
但如果使用白色背景色的简单视图,则没有线条 您可以尝试不设置线条样式,如:
contentTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
并在我使用的
UITableViewCell
的底部添加一条灰线(从上往下看):contentTableView.backgroundColor=[UIColor clearColor];contentTableView.separatorColor=[UIColor clearColor];contentTableView.separatorStyle=UITableViewCellSeparatorStyleNone;因为UINavigationController有1px(视网膜中为0.5px)阴影线,UITableViewCell的1px(视网膜中为0.5px)灰线位于点(0,0)。在静止状态下,导航阴影隐藏单元格灰线,但实际上灰线存在。[[UINavigationBar外观]设置阴影图像:[[UIImage alloc]init]代码>删除的导航栏阴影。但没有帮助…问题不在于导航,而在于UITableViewCell上点(0,0)处的灰色顶线。您可以尝试设置UITableView.separatorInset
和UITableViewCell.separatorInset
。不起作用。。。已尝试的UIEdgeInsetsMake(0,50,0,0);和UIEdgeInsetsZero尝试注释contentInset行并检查一次。
contentTableView.separatorStyle = UITableViewCellSeparatorStyleNone;