Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何锁定UITable,防止其滚动超出表中的项目_Iphone_Ios_Objective C_Uitableview - Fatal编程技术网

Iphone 如何锁定UITable,防止其滚动超出表中的项目

Iphone 如何锁定UITable,防止其滚动超出表中的项目,iphone,ios,objective-c,uitableview,Iphone,Ios,Objective C,Uitableview,我有一个UITableView向上滚动得太远,以至于UITableView中的项目列表向上滚动,随后出现大量空白 如何阻止UITableView滚动多余的空间 希望我描述得足够好。我想这可能适合你。在表上调用reloadData后运行此代码: if (table.contentSize.height < table.frame.size.height) { table.scrollEnabled = NO; } else { table.scrollEnabled = YE

我有一个
UITableView
向上滚动得太远,以至于
UITableView
中的项目列表向上滚动,随后出现大量空白

如何阻止
UITableView
滚动多余的空间


希望我描述得足够好。

我想这可能适合你。在表上调用
reloadData
后运行此代码:

if (table.contentSize.height < table.frame.size.height) 
{
   table.scrollEnabled = NO;
}
else 
{
   table.scrollEnabled = YES;
}
if(table.contentSize.height
这里,
table.frame.size.height
是屏幕上显示的对象的实际大小(您可以在界面生成器中看到),而
table.contentSize.height
是添加在一起的
页眉
页脚
和每个单元格的
高度

我在这里找到的:


希望你能从他们给出的答案中得到一些东西。

我想这可能对你有用。在表上调用
reloadData
后运行此代码:

if (table.contentSize.height < table.frame.size.height) 
{
   table.scrollEnabled = NO;
}
else 
{
   table.scrollEnabled = YES;
}
if(table.contentSize.height
这里,
table.frame.size.height
是屏幕上显示的对象的实际大小(您可以在界面生成器中看到),而
table.contentSize.height
是添加在一起的
页眉
页脚
和每个单元格的
高度

我在这里找到的:


希望您也能从给出的答案中得到一些信息。

这将解决您的问题

TableView.bounces=NO;
这将删除空单元格

TableView.separatorStyle = UITableViewCellSeparatorStyleNone;

这会解决你的问题

TableView.bounces=NO;
这将删除空单元格

TableView.separatorStyle = UITableViewCellSeparatorStyleNone;

contentSize是否正确?在numberOfRowsForIndexPath中返回的数字是否正确?在numberOfRowsForIndexPath中返回的数字是否正确