UIScrollView's origin changes after popping back to the UIViewController

后端 未结 17 2327
不知归路
不知归路 2020-12-07 16:50

I have a UIViewController subclass as a scene in the storyboard that contains a UIScrollView containing various subviews. One of the subviews is a

17条回答
  •  自闭症患者
    2020-12-07 16:53

    Actually, I put that line of code in viewDidDisappear, and so that it remembers the offset when the view reappears, I added this line before it

     self.contentOffset = self.scrollView.contentOffset;
    

    as well as

     - (void)viewDidLayoutSubviews { 
           self.scrollView.contentOffset = self.contentOffset; 
     }
    

提交回复
热议问题