Get UIScrollView to scroll to the top

前端 未结 15 1869
眼角桃花
眼角桃花 2020-12-07 08:41

How do I make a UIScrollView scroll to the top?

15条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 09:14

    I tried all the ways. But nothing worked for me. Finally I did like this.

    I added self.view .addSubview(self.scroll) line of code in the viewDidLoad. After started setting up frame for scroll view and added components to scroll view.

    It worked for me.

    Make sure you added self.view .addSubview(self.scroll) line in the beginning. then you can add UI elements.

提交回复
热议问题