简体   繁体   English

在调用popViewControllerAnimated之后,UITableview滚动到顶部

[英]UITableview scrolling to top after popViewControllerAnimated is called

I am having an issue with an UITableView . 我在UITableView上遇到问题。

I am displaying a collection of tracking records. 我正在显示跟踪记录的集合。 After the user taps on a cell, a detail view controller is displayed with detailed data. 用户点击单元格后,将显示包含详细数据的详细视图控制器。 My problem is after I call popViewControllerAnimated:YES from the Detail view controller, my table view is reseted and scrolls to the top position automatically. 我的问题是从“详细信息”视图控制器调用popViewControllerAnimated:YES后,我的表视图被重置并自动滚动到顶部位置。

I am not calling [myTable reloadData]; 我没有打电话给[myTable reloadData]; on viewWillAppear and I find this behavior kinda strange. viewWillAppear ,我发现这种行为有点奇怪。

Does anyone have an idea what I might be missing here? 有人知道我在这里可能会错过什么吗?

Any help or tip would be appreciated! 任何帮助或提示将不胜感激!

Thanks, Granit 谢谢,Granit

It's a known issue. 这是一个已知问题。

The more the estimatedRowHeight differs from the actual height, the more the table will jump when the push segue happens. estimatedRowHeight高度与实际高度之间的差异越大,在进行推挤操作时桌子将跳得越多。 The easiest workaround is to use a much better estimate. 最简单的解决方法是使用更好的估计。

if you don't call reloadData then either you re-add the table somewhere or you popped ViewController was reloaded because of some reason. 如果不调用reloadData,则可以在某个地方重新添加表,或者由于某种原因弹出ViewController重新加载。 Does ViewDidLoad called when you pop back? 弹出时是否调用ViewDidLoad?

How about storing the table scrolling state? 如何存储表格的滚动状态? (contentOffset) (contentOffset)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 popViewControllerAnimated之后,UINavigationBar下的UITableView - UITableView under UINavigationBar after popViewControllerAnimated 设置ContentInset后,UITableView节不会滚动到顶部 - UITableView Sections are not scrolling to top after ContentInset set iOS:popViewControllerAnimated调用后的回调函数? - iOS: Callback function after popViewControllerAnimated called? 在popViewControllerAnimated之后调用Dealloc而不调用viewDidUnload - Dealloc called after popViewControllerAnimated without calling viewDidUnload 滚动到顶部后未调用 TodayExtension 的 ViewWillAppear - TodayExtension's ViewWillAppear not called after scrolling to the top 滚动到UITableView中的UISearchBar的顶部 - Scrolling to the top of the UISearchBar in a UITableView 插入新行后如何停止UITableView滚动到顶部? - How to stop UITableView scrolling to top after insert new row? 每次调用popViewControllerAnimated后都会调用viewDidLoad: - viewDidLoad getting called every time after calling popViewControllerAnimated: 滚动到顶部时,uitableview autoupadate - uitableview autoupadate while scrolling to top 在contentInset之后UITableView不滚动 - UITableView Not Scrolling after contentInset
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM