XCode:设置多个 UITableView 列 [英] XCode: Setting up multiple UITableView columns

查看:25
本文介绍了XCode:设置多个 UITableView 列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还没有找到一个好的答案,而且我一定很密集,但是...

I haven't found a good answer to this, and I must be dense, but...

我正在尝试设置一个表视图,每行都有一个图像和一个标签.该图像将是一个指示图像(新的、进行中的、已停止的、已完成的等),标签将是一个特定的问题名称.

I'm trying to get a table view set up with an image and a label in each row. The image would be an indicator image (New, In Progress, Stopped, Finished, ect.) and the label would be a particular issue name.

我可以用一列正常设置表格视图,但我找不到任何设置表格列数的内容(在代码中或在界面生成器中).我假设我必须为表格设置两列.

I can set up the table view normally with one column, but I can't find anything (in the code or in the Interface Builder) that sets the number of columns for a table. I assume I would have to set up two columns for the table.

在那之后,我还需要关于如何将图像添加到第一列并将标签添加到第二列的帮助.基本上,我想要与 iPhone 的原生相册应用程序相同的功能和外观,它在左侧显示一个缩略图,在中间显示一个标签.并且请像对待我一样愚蠢,因为我已经搜索了所有内容,并且互联网上的每个人似乎都可以在 IB 中选择用于设置列数的表视图......除了我之外的每个人.:P

After that, I also need help on how I add the image to the first column and add the label to the second column. Basically, I want the same functionality and appearance you get from the iPhone's native Photo Album app, which shows a thumbnail on the left and a label in the center. And please treat me like I'm stupid, as I've searched all over, and everyone on the internet seems to have an option in the IB for table views that sets the number of columns...everyone but me. :P

推荐答案

您最好的做法是创建您自己的自定义 UITableViewCell 并专门设计它以包含图像和文本标签.除此之外的任何事情都意味着您将不得不开始继承 UITableView 这不适合胆小的人.另一种选择是查看 3rd 方库,例如 AQGridView.

Your best course of action is to create your own custom UITableViewCell and specifically design it to include an image and a text label. Anything beyond that means you're going to have to start subclassing UITableView which isn't for the faint of heart. Another option is to look into a 3rd party library such as AQGridView.

这篇关于XCode:设置多个 UITableView 列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆