如何使 UITableview 精确高度? [英] How to make UITableview exact height?

查看:22
本文介绍了如何使 UITableview 精确高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题如果我单击此按钮,则在主视图上有一个按钮,将主视图上的子视图添加为 tableview这是代码

I have following issue I am having one button on main view if i was click on this button add subview on the main view as tableview here is the code

FNsettingsViewController *fnsettings = [[FNsettingsViewController alloc]initWithNibName:@"FNsettingsViewController" bundle:nil];
fnsettings.delegate=self;
[fnsettings.view setFrame:CGRectMake(0, 30, self.view.frame.size.width,250)];
[self.view addSubview:fnsettings.view];

在我点击按钮后,将子视图作为表格视图,但其余部分有一个空格.

after i was click on the button get the subview as tableview but rest of them having an whitespace.

然后如何去除剩余的空格.

then how to remove the remaining whitespace.

请知道的人帮助我.

推荐答案

在为 Tableview 分配值之前,您会知道单元格计数对吗?试试我的代码:

Before allocate value to the Tableview you will knows the cells count right? the try my code:

float height=[arrayTableValues count]*height of your single cell;
tableview.frame=CGRectMake(0,30,self.view.frame.size.width,height);

这篇关于如何使 UITableview 精确高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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