清除 UITableViewCell 的背景颜色?

发布于 2024-12-23 02:40:37 字数 707 浏览 4 评论 0原文

我加载 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 enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何必那么矫情 2024-12-30 02:40:37

更改视图的背景,在你的笔尖中,使其清晰颜色或白色

也可以尝试

在方法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];

混吃等死 2024-12-30 02:40:37

你好,RRB

您必须设置 tableView.backgroundColor 运行时的clearColor 不在 xib 中

hi RRB

You have to set clearColor of your tableView.backgroundColor run time not in xib.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文