清除 UITableViewCell 的背景颜色?
我加载 UITableView 部分中的所有数据。 我得到上面屏幕的结果。我想删除表格单元格的黑色补丁(背景颜色)。 为此,我在 cellForRowAtIndexPath 方法中编写以下代码
cell.backgroundColor = [UIColor whiteColor];
[cell setOpaque:NO];
NSDictionary *name = [[self.sections valueForKey:[[[self.sections allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
[cell.textLabel setFont:[UIFont systemFontOfSize:15.0f]];
[cell.textLabel setText:[name objectForKey:@"Name"]];
,我的 nib 文件是
我仍然给出相同的结果。此代码和笔尖设置在 iPhone 模拟器上运行良好,但在 iPhone 中则不然。 请问为什么会发生这种情况,我哪里走错了? 我如何消除这个问题?
提前致谢。
I loading all data in UITableView section.
i getting result of above screen. I want to remove black patch(background color) of table cell.
For that i write following code in cellForRowAtIndexPath method
cell.backgroundColor = [UIColor whiteColor];
[cell setOpaque:NO];
NSDictionary *name = [[self.sections valueForKey:[[[self.sections allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
[cell.textLabel setFont:[UIFont systemFontOfSize:15.0f]];
[cell.textLabel setText:[name objectForKey:@"Name"]];
and my nib file is
still i give same result. This code and nib setting worked fine on iPhone simulator but not in iPhone.
Please why this happen, where i m going to wrong way?
How i remove this problem?
Thanks in advanced.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更改视图的背景,在你的笔尖中,使其清晰颜色或白色
也可以尝试
在方法CellForRowAtIndexPath中,如tableView.backgroundColor = [UIColor clearColor];
Change the Background of View, in your nib, make it clear Color or white Color
also try
in method CellForRowAtIndexPath, like tableView.backgroundColor = [UIColor clearColor];
你好,RRB
您必须设置 tableView.backgroundColor 运行时的clearColor 不在 xib 中。
hi RRB
You have to set clearColor of your tableView.backgroundColor run time not in xib.