Ios6 UITableView在插入新行后不滚动到最后一行
我正在尝试使用从其他类插入TableViewController的tableView对象中的行Ios6 UITableView在插入新行后不滚动到最后一行,ios6,uiscrollview,uikit,uitableview,Ios6,Uiscrollview,Uikit,Uitableview,我正在尝试使用从其他类插入TableViewController的tableView对象中的行 UINavigationController *navigationController = (UINavigationController *)[UIApplication sharedApplication].keyWindow.rootViewController; ReceiptHomeTableViewController *homeTableViewController= (Rec
UINavigationController *navigationController = (UINavigationController *)[UIApplication sharedApplication].keyWindow.rootViewController;
ReceiptHomeTableViewController *homeTableViewController= (ReceiptHomeTableViewController*)navigationController.viewControllers[0];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:([[PersistenceService getInstance] count]-1) inSection:0];
[homeTableViewController.tableView insertRowsAtIndexPaths:@[indexPath]
withRowAnimation:UITableViewRowAnimationNone];
我也尝试过使用
//[homeTableViewController.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
//[homeTableViewController.tableView reloadData];
但是HomeTableViewController只显示适合屏幕宽度的行。我试图滚动到底部,但它没有滚动到最后一行。
如果重新启动应用程序并使用ellforrowatinedexpath:方法创建单元格,则滚动效果非常好,但如果添加新行,则滚动将无法工作
当添加行时,UI似乎不会更新视图的新长度。有什么帮助吗?由于声誉低于50,我无法发表评论。所以我想在回答部分给出关于这个问题的建议 根据您的问题,您必须发布
cellforrowatinexpath
方法。然后只有线索会点击。请NSLog
在tableCell子视图中查看新行对象
在你编辑完你的帖子后,如果我得到答案或任何线索,我会在这篇帖子中通过编辑给出答案。我发现了问题。默认情况下,我在tableviewcontroller上启用了自动布局。关掉它对我有用
感谢您的评论您好,现在您应该可以发表评论了。
;)代码>