来自 NSMutableArray iPhone 的 UITableView

发布于 2024-12-09 11:26:42 字数 175 浏览 0 评论 0原文

我有一个包含对象 1-10 的数组(比方说)。我想要 cell.textLabel.text = 1,3,5,7... 我想要 cell.detailtextLabel.text = 2,4,6,8...

如何让详细文本交替?

或者,有更好的办法吗?制作两个 mutableArray 并将它们组合起来?

I have an array with objects 1-10 (let's say). I want the cell.textLabel.text = 1,3,5,7... and I want the cell.detailtextLabel.text = 2,4,6,8...

How do I get the detail text to alternate?

Or, is there a better way? Make two mutableArrays and combine them?

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

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

发布评论

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

评论(1

━╋う一瞬間旳綻放 2024-12-16 11:26:42

我认为这应该有效:

cell.textLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)];
cell.detailtextLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)+1];

I think this should work:

cell.textLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)];
cell.detailtextLabel.text = [yourlist objectAtIndex:(indexPath.row * 2)+1];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文