Reputation: 597
Hello, I have uploaded two images. Initially, my screen will look like First Image. If the user scrolls up the screen, then the screen will look like the Second Image. I have searched in GitHub and internet for a stretchable header. I found a solution where a view has made programmatically. But I am unable to load more two views inside that particular view for the design purpose. If I load a custom UI view it is showing error in this function ->
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let y = 300 - (scrollView.contentOffset.y + 300)
let height = min(max(y, 60), 400)
//imageView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: height)
myNewView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: height)
}
Help is much appreciated
Upvotes: 1
Views: 5920
Reputation: 318
You can refer to GitHub libraries. Here are some links to it.
1.A generic stretchy header for UITableView and UICollectionView
https://github.com/gskbyte/GSKStretchyHeaderView
2.A generic stretchy header for UIScrollView, and allows you to change navigation bar's appearance dynamically.
https://github.com/sunlubo/StretchyHeaderView
3.You can use one article which was found on medium.com
Same thing I have done with CustomUIView by using this.
https://github.com/maxep/MXSegmentedPager
Upvotes: 1