Created
September 24, 2022 19:31
-
-
Save Anik0808/bfde2c29504875078f8b9dbf6c102323 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func setupView(){ | |
view.backgroundColor = .black | |
//setup the scrollView | |
view.addSubview(parentScrollView) | |
parentScrollView.fillSuperview() | |
parentScrollView.contentSize = CGSize(width: DeviceSize.width, | |
height: DeviceSize.height*2) | |
//setup the content view | |
parentScrollView.addSubview(contentView) | |
contentView.anchorView(left: parentScrollView.leftAnchor, | |
width: parentScrollView.contentSize.width, | |
height: parentScrollView.contentSize.height) | |
//setup content view top anchor | |
contentViewTopAnchor = contentView.topAnchor.constraint(equalTo: parentScrollView.contentLayoutGuide.topAnchor, constant: 0) | |
//activate it | |
contentViewTopAnchor.isActive = true | |
//setup the header view | |
contentView.addSubview(headerView) | |
headerView.anchorView(top: contentView.topAnchor, | |
left: contentView.leftAnchor, | |
right: contentView.rightAnchor) | |
//setup header view height anchor | |
headerViewHeightAnchor = headerView.heightAnchor.constraint(equalToConstant: 450) | |
//activate it | |
headerViewHeightAnchor.isActive = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment