如何更改分组的UITableView的边框颜色
-
25-09-2019 - |
题
此关注的iPhoneOS-SDK-3.2
我有困难改变分组的UITableView的边框颜色。我可以改变细胞的背景颜色,色彩分离器,文本颜色,很容易,现在,圆角正确修剪,即使与我选择什么颜色突出显示。然而周边边界仍然尽管许多不同的尝试僵硬灰色。
我已阅读所有相关的帖子我可以通过谷歌找到,更不用说计算器。我见过迈克埃克斯的UITableViewCell的剪裁英雄PITA解决方案 - 这个问题解决了的iPhoneOS 3.0并没有帮助我的边界。
我试图既一个方案和XIB-基于溶液和都提供相同的结果。
我将共享下面的方案版本:
我有一个UIViewController子类,而不是一个UITableViewController子类来作为一个UITableView委托 - 我选择了为我编码在iPad上,据报的UITableViewController接管整个屏幕这条路线。的我的UIViewController子类的loadView方法:
- (void) loadView {
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[self.view release];
self.view.backgroundColor = [UIColor blackColor];
// add and configure UITableView
CGRect tableViewRect = CGRectMake(0., 0., 256., 768.);
myTableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStyleGrouped];
// set the tableview delegate to this object and the datasource to the datasource which has already been set
myTableView.delegate = self;
myTableView.dataSource = self;
myTableView.sectionIndexMinimumDisplayRowCount = 1;
myTableView.backgroundColor = [UIColor clearColor];
myTableView.separatorColor = [UIColor whiteColor];
myTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
myTableView.opaque = NO;
// add the table view to our background view
[self.view addSubview:myTableView];
[myTableView release];
}
解决方案
我发现了一个解决方案。此行为确实出现的iPhoneOS 3.2具体如苹果的iPhoneOS 3.2添加的UITableView一个backgroundView属性。
我试图[myTableView.backgroundView removeFromSuperView]和UITableView的只是用另一个替换它。
相反,我的解决办法是添加:
myTableView.backgroundView.hidden = YES;
不隶属于 StackOverflow