UIScrollView contentOffset change after another view pushed

后端 未结 6 2020
遇见更好的自我
遇见更好的自我 2020-12-31 17:26

I have a UIViewController in Interface Builder, and I add a UIScrollView to the UIView. It has a contentOffset property e

6条回答
  •  执笔经年
    2020-12-31 18:01

    i had a similar problem, after dismissing a viewController, the contentOffset from my tableView was changed to (0, -64).

    my solution was a little weird, i tried all the other answers but had no success, the only thing that fixed my problem was to switch the tableView position in the controls tree of the .xib

    it was the first control in the parent View like this:

    before

    I moved the tableView right after the ImageView and it worked:

    after

    it seems that putting the table view in the first position was causing the trouble, and moving the table view to another position fixed the problem.

    P.D. I'm not using autoLayout neither storyboards

    hope this can help someone!

提交回复
热议问题