xCode4 尝试将自定义图标添加到 tableView 单元格

发布于 2024-12-18 00:44:34 字数 649 浏览 2 评论 0原文

我将自定义图标添加到 tableView 时得到的结果好坏参半。我当然可以使用一些帮助来解释为什么......

我的代码如下:

if (cell.textLabel.text == @"People") {
        cell.imageView.image = [UIImage imageNamed:@"People.png"];
    }
    if (cell.textLabel.text == @"Summary") {
        cell.imageView.image = [UIImage imageNamed:@"Summary.png"];
    }
    if (cell.textLabel.text == @"Date") {
        cell.imageView.image = [UIImage imageNamed:@"Date.png"];

People.png 工作正常。 Summary.png 向右偏移,Date.png 不显示。

请参阅附图..

自定义单元示例

文件检查器

I am having mixed results adding custom icons to a tableView. I sure could use some help as to why..

My code is as follows:

if (cell.textLabel.text == @"People") {
        cell.imageView.image = [UIImage imageNamed:@"People.png"];
    }
    if (cell.textLabel.text == @"Summary") {
        cell.imageView.image = [UIImage imageNamed:@"Summary.png"];
    }
    if (cell.textLabel.text == @"Date") {
        cell.imageView.image = [UIImage imageNamed:@"Date.png"];

People.png works ok. Summary.png is offset to the right, and Date.png doesn't show.

Please see the attached image..

Custom Cell Sample

File Inspector

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

起风了 2024-12-25 00:44:34

您正在将 NSString 与 == 进行比较!?

You're comparing NSStrings with == !?

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