管理UITableView单元格的高度 [英] Manage height of UITableView cell

查看:45
本文介绍了管理UITableView单元格的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对iPhone开发非常陌生.我正在从表中获取数据并将其放到UITableViewCell上.但是有时这些数据很小,有时可能很大.根据数据大小,我需要管理单元格的高度,如果多行单元格不适合单行,则数据会正确显示在多行单元格中.除了UITableView之外,我还有其他选择吗?还是我做对了.如果是,那我该怎么办?

I am very new to iPhone Development. I am fetching data from the table and putting it onto the UITableViewCell. But sometimes this data is very small and sometimes may be large. According to the data size I need to manage the height of cell and data is displayed properly in a cell with multiline if it doesn't fit to single line. Is there any other option for me instead of UITableView or I am in Right way. If yes then how should I proceed?

推荐答案

使用此委托将增加行大小

use this delegate it will increase the row size

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

-(CGFloat)tableView :(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

 {
    return 80;   //value can be changed depending, how much height you need.
 }

这篇关于管理UITableView单元格的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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