在表格视图的单元格中显示多行-iOS [英] Display multiple lines in a Table view's cell - IOS

查看:76
本文介绍了在表格视图的单元格中显示多行-iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我正在处理的IOS应用程序的表单元格视图中显示多行.确切地说,我有一个表格视图,其中将填充从服务器返回的JSON数据,在这里,如果返回的状态是0或2(状态是为配置文件返回的JSON对象之一),必须显示5-6行的错误消息.

i want to display multiple lines in a Table's cell view for an IOS app that i'm working on. To be precise, i have a table view which will be populated with the JSON data that is returned from server, in here if the status returned is 0 or 2 (Status is one of the JSON object that is being returned for a profile) i have to display an error message that is of 5-6 lines.

自定义表格的单元格视图以显示2个UILabel,显然,此单元格的高度足够小以显示2个标签.我找到了一个解决方案,但实际上并不能解决问题.任何人都可以提出不同的解决方案.如果可能,链接到示例将有很大帮助.谢谢

Table's cell view is customized to display 2 UILabel's and obviously the height of this cell is small enough to display 2 labels. I found one solution, but it doesn't actually solve the problem. Can anyone suggest a different solution. If possible, link to an example will be a great help. Thanks

推荐答案

您要搜索的内容称为动态尺寸"单元格.有一个有关如何实现此目标的教程: http: //www.raywenderlich.com/73602/dynamic-table-view-cell-height-auto-layout

What you're searching for is called "dynamic sized" cells. There is a tutorial on how to realize this : http://www.raywenderlich.com/73602/dynamic-table-view-cell-height-auto-layout

它确实按照文本长度的函数来调整所有单元格的高度,如下例所示:

It does resize all cells height in function of the text length like in this example:

这篇关于在表格视图的单元格中显示多行-iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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