StretchyLayout | An example project for a post | Content Management System library
kandi X-RAY | StretchyLayout Summary
kandi X-RAY | StretchyLayout Summary
An example project for a post on blog.enabled.com.au
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of StretchyLayout
StretchyLayout Key Features
StretchyLayout Examples and Code Snippets
Community Discussions
Trending Discussions on StretchyLayout
QUESTION
I'm trying to follow the example described here for making a stretchy layout which includes a UIImageView
and UIScrollView
. https://github.com/TwoLivesLeft/StretchyLayout/tree/Step-6
The only difference is that I replace the UILabel
used in the example with the view of a child UIViewController
which itself contains a UICollectionView
. This is how my layout looks - the blue items are the UICollectionViewCell
.
This is my code:
...ANSWER
Answered 2019-Feb-18 at 00:36It looks like you are constraining the size of your collection view to fit within the bounds of the parent view containing the collection view's container view and the image view. As a result, the container scrollView
has no contentSize
to scroll over, and that's why you can't scroll. You need to ensure your collection view's content size is reflected in the parent scroll view's content size.
In the example you gave, this behavior was achieved by the length of the label requiring a height greater than the height between the image view and the rest of the view. In your case, the collection view container needs to behave as if it's larger than that area.
Edit: More precisely you need to pass the collectionView.contentSize
up to your scrollView.contentSize
. A scrollview's contentSize
is settable, so you just need to increase the scrollView.contentSize
by the collectionView.contentSize
- collectionView.height
(since your scrollView's current contentSize
currently includes the collectionView's height). I'm not sure how you are adding your child view controller, but at the point you do that, I would increment your scrollView's contentSize accordingly. If your collectionView's size changes after that, though, you'll also need to ensure you delegate that change up to your scrollView
. This could be accomplished by having a protocol such as:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install StretchyLayout
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page