How can I change view UIScrollVIew by paging Mode?
How can I change view UIScrollVIew by paging Mode?
I made a UIScrollView and add 2 SubViews.(View1, View2)
So, I can page down if i swipe because i set .isPagingEnabled = true.
And now I make a one button in View1.
What I want to do is change View2 when i click this button.
To be specific, change view by paging mode.(not like scrolling)
button.addTarget(self, action: #selector(downBtnTapped), for: .touchUpInside)
@objc func downBtnTapped()
if verticalScroll.contentOffset.y < self.view.bounds.height * CGFloat(2)
verticalScroll.contentOffset.y += self.view.bounds.height
if i tried upper code, just chnage view directly, not like paging Mode
How can i solve this problem ?
@objc func downBtnTapped() var contentOffset = verticalScroll.contentOffset contentOffset.y = self.view.bounds.height verticalScroll.setContentOffset(contentOffset, animated: true)
– cslee92
Sep 17 '18 at 3:44
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy
add animation like this? UIView.animate(withDuration: 1.0) self.verticalScroll.contentOffset.y += self.view.bounds.height
– E.Coms
Sep 17 '18 at 0:27