问题
I basically want to copy Instagrams and Twitters profile pages. If I add a CollectionView to the bottom half, the CollectionView only scrolls on the bottom half of the page. The cells do not go all the way to the top and consume the profile statistics in the process.
How can I make it so the profile statistics are consumed while scrolling, and the collection view takes up the whole screen? I can't seem to figure out how to make it so the cell only takes up the bottom half while the collection view takes up the whole screen.
Anyone have any ideas on how this can be done? New to Xcode here and just trying to learn some skills.
I already have it so that the images are loaded into a grid using a custom function, but then if I were to click on the image to go to the next view of a full sized image, there is no way to get the postID of that selected image, so I need the cell functionality.
回答1:
Images/Post you see in Instagram Profile screen are UICollectionViewCell and the profile details or statistics you see is HeaderView or UICollectionReusableView.
Use a vertical collection view with flow layout. Use cells for showing posts and headerView for showing details. By this way you will get the desired behaviour.
Follow these tutorials to know how it's possible-
CollectionView ReuasbleView
RayWenderlich Tutorial
来源:https://stackoverflow.com/questions/59490910/how-can-i-get-a-collectionview-to-only-load-images-on-the-bottom-half-while-sti