“Next” button not disappearing in app when it's supposed to
“Next” button not disappearing in app when it's supposed to
Shown below is the code that I am using to get my next button to disappear. However the button does not disappear.
func nextPage()
//we are on the last page
if pageControl.currentPage == pages.count
moveControlConstraintsOffScreen()
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseOut, animations:
self.view.layoutIfNeeded()
, completion: nil)
//second last page
if pageControl.currentPage == pages.count
return
let indexPath = IndexPath(item: pageControl.currentPage + 1, section: 0)
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
pageControl.currentPage += 1
1 Answer
1
From your link, it seems like you are adding your nextButton
to view
. You need to call this method to make it disappear.
nextButton
view
view.sendSubviewToBack(nextButton)
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Where is your button in your code?
– Fangming
Jun 27 '17 at 15:31