gpt4 book ai didi

ios - ScrollView 关闭 subview 后总是回到起始位置

转载 作者:行者123 更新时间:2023-11-30 11:02:09 25 4
gpt4 key购买 nike

我的应用程序有主视图和多个 subview 。我想做的是当 View2?.removeFromSuperview() 时,scrollView将从头开始。因为现在我将 subview 放在主视图上,然后当我返回主视图时, ScrollView 与之前的位置相同。

最佳答案

offset = CGPoint(x: -yourScrollView.adjustedContentInset.left,y: -yourScrollView.adjustedContentInset.top)    
yourScrollView.setContentOffset(offset, animated: true)

试试这个

关于ios - ScrollView 关闭 subview 后总是回到起始位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53216896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com