
我正在从JSON feed加载多个(3-4)个项目(数量将因天而异)。每个项目都有4个属性:图标、标题、副标题和large_image。在解析和显示第一个项目之后,我希望显示下一个项目。
我的问题是:我可以为提要中的每个项目定制一个类似这样的UITableViewCell吗?如果是这样,我该怎么做呢?通过google/stackoverflow搜索,我看到了如何在自定义单元格中执行图标image + title + subtitle,但没有看到如何合并大图像。
如果不是自定义UITableView,如何启用?我是否可以根据提要中的项数动态地呈现单独的UILabels和UIImageViews?
谢谢!
发布于 2013-02-12 14:06:59
非常简单,但对iOS的初学者来说很好。
以下是步骤:
Create a xib file (which should be a subclass of UITableViewCell. Drag and drop 2 UILabels, and place it how you want for each row. Drag and drop 2 imageviews as well. One should be for icon, (preferably smaller in size) and other one should depict the large image.
In `cellForRowAtIndexPath method of tableview, try to load the custom cell object and pass the values you have in json parsed array (formatted array containing data for each row). Update your cell UI in cellforRowAtIndexPath.` Click here - this is something which best fits your issue, you can customize more according to your need. (add label, largeimageview)
希望能有所帮助。
发布于 2013-02-12 14:09:39
你正在寻找一个自定义的uitableviewcell。这个问题已经被问到了here,还有一个教程链接。从一个简单的例子开始。
https://stackoverflow.com/questions/14826368
复制相似问题