Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.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
在UITableView中插入一些行后,它不会在ios 7中滚动_Ios_Iphone_Uitableview_Ios7 - Fatal编程技术网

在UITableView中插入一些行后,它不会在ios 7中滚动

在UITableView中插入一些行后,它不会在ios 7中滚动,ios,iphone,uitableview,ios7,Ios,Iphone,Uitableview,Ios7,嗨,我已经创建了UITableView。触摸it单元时,我会在其中插入更多行。在UITableView中插入更多行后,滚动不起作用。这只发生在ios 7中 有没有人遇到过这个问题 这是插入代码 NSArray *rowIndex = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:[self.lastSelectedIndex section]]]; [self.table beginUpdates]; [sel

嗨,我已经创建了UITableView。触摸it单元时,我会在其中插入更多行。在UITableView中插入更多行后,滚动不起作用。这只发生在ios 7中

有没有人遇到过这个问题

这是插入代码

NSArray *rowIndex = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:1 inSection:[self.lastSelectedIndex section]]];
[self.table beginUpdates];
[self.table insertRowsAtIndexPaths:rowIndex withRowAnimation:UITableViewRowAnimationNone];
[self.table endUpdates];

你用故事板创建视图了吗?也许你必须检查你的约束条件。
如果您的表视图占用了视图中的所有空间,请选择它,然后转到“编辑器>插针>顶部空间到superview,底部空间到superview”

我不确定代码中发生了什么,但如果您想在每个添加行后滚动,只需调用下面的方法(注意:-根据变量名称修改代码)


嗨,米兹,谢谢你的回复。其实我不是在找这个。问题是在tableview中插入几行之后,它根本就不会滚动。甚至我的内容大小(高度)也超过了表视图的高度。不管怎样,在插入行之后,我都会将特定的拖到顶部<代码>[self.table scrollToRowatinexPath:self.lastSelectedIndex atScrollPosition:UITableViewScrollPositionTop动画:展开\u动画]我没有澄清你到底想要什么?我有一个大约10项的桌面视图。其内容高度大于表视图高度。因为表格视图是滚动视图的子视图。它应该开始自动滚动。直到这里工作正常。现在假设用户要触摸2个单元格。这里我在表格视图中再添加10个单元格。tableview内容高度将再次增加。在这里插入10多行后,表视图不再滚动。这只发生在ios7中,与其他操作系统版本配合良好。您好,我是通过编程方式创建它的。我没有使用xib或故事板。这在ios 6 5 4中运行良好。只有ios 7才会出现这种情况。
-(void)goToBottom
{
     NSInteger lastSectionIndex = MAX(0, [myTableName numberOfSections] - 1);
     NSInteger lastRowIndex = MAX(0, [ myTableName numberOfRowsInSection:lastSectionIndex] - 1);

     NSIndexPath *lastIndexPath = [NSIndexPath indexPathForRow:lastRowIndex inSection:lastSectionIndex];

   if([myArray count] > 0)
    {
        [myTableName scrollToRowAtIndexPath:lastIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
    }

}