点击后退按钮后导航栏重置内容偏移
我有一堆由 Navigationbar.PushViewController(...) 显示的滚动视图。当我向他们展示时,这些控件已设置了 contentOffset。问题是,点击导航栏中的后退按钮后,此偏移量将更改为 Point 0,0,然后它会变为正确的值。设置为 0,0 会导致我的控件在不需要时加载数据(用户未更改偏移量)。如何避免偏移量的“临时重置”?
I have a bunch of scrolling views displayed by Navigationbar.PushViewController(...). When I show them these controls have their contentOffset set. The problem is that after tapping a back button in the navigationbar this offset is changed to Point 0,0 and after that it goes to the correct value. The setting to 0,0 causes my controls to load data while not required (offset was not changed by user). How can I avoid this 'temporary reset'of the offset?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过将 contentOffset 存储在 ViewWillDisappear 的变量中?然后在ViewDidAppear中重置contentOffset?
我认为您正在体验的 contentOffset 功能是 UIKit 的一个功能(哈哈)。
Have you tried storing the contentOffset in a variable in ViewWillDisappear? Then resetting contentOffset in ViewDidAppear?
I think the contentOffset functionality you are experiencing is a feature (ha ha) of UIKit.