SOLVED: 'barHideOnSwipeGestureRecognizer' works with two UIScrollViews but not with two others
SOLVED: 'barHideOnSwipeGestureRecognizer' works with two UIScrollViews but not with two others
- Subject: SOLVED: 'barHideOnSwipeGestureRecognizer' works with two UIScrollViews but not with two others
- From: David Hoerl <email@hidden>
- Date: Sun, 08 Nov 2015 09:23:54 -0500
- X_v_e_cd: 0342522817250117f225c6ae9549ff7b
- X_v_r_cd: ca10c71f4a69fdbc400e2aabed6f8202
On 11/6/15 1:17 PM, David Duncan wrote:
On Nov 6, 2015, at 8:04 AM, David Hoerl <email@hidden> wrote:
I know this is an esoteric question.
I enabled 'hidesBarsOnSwipe' in my MMSpreadSheet view controller. This UIView subclass has 4 UICollectionViews in it - two up top and two below.
The top left 'corner' controller does not scroll, and the top right does not scroll vertically. Out of the box up/down swipes work perfectly with the barHideOnSwipeGestureRecognizer to get the Navigation Bar to hide/show.
But try as I might, I cannot get the bottom two views to provide the same functionality, both of which scroll vertically. I tried adding a new UIPanGestureRecognizer to the collectionView that returns 'true' when sent the delegate message 'shouldRecognizeSimultaneouslyWithGestureRecognizer'. Interesting that I actually get asked if this new recognizer should work with both the 'barHideOnSwipeGestureRecognizer' and the CollectionView's panGestureRecognizer (I return 'true' for both).
I also configured this new recognizer to exactly match the configuration of the UICollectionViews panGestureRecognizer.
Just odd that the barHideOnSwipeGestureRecognizer has added itself to the collection view, but refuses to handle the swipe.
The scroll (collection) view needs to abut or underlap the navigation bar for the gesture to recognize, which is why your bottom collection views don’t work. There isn’t a way to override this behavior, so I don’t really have any good answers for how you might obtain it.
Any suggestions?
- David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
David Duncan
David,
Thanks so much for the information! What I ultimately did was to add a
"shadow" ScrollView to this class as the top view, with no content, and
as each of the other scrollviews is effectively tapped, have this shadow
scrollview provide the UI and update the other scrollview offsets as
needed during and after scrolling.
This behavior got me all I needed for both hiding/showing the Navigation
Bar, as well as scrollToTop when tapping on the Status Bar, as well as
bonafide scroll indicators, so it was a huge win overall.
Thanks again for explaining the technical issue!
David
PS: I might have been able to solve it by making the bottom two
collection views extend to the top of the view, then use content inset
to "push" the real content down. That said, the shadow scrollView
actually makes the code smaller and easier to read and understand.
PSS: The WWDC 2014 Advanced ScrollView session was the inspiration for
my solution - that was a great Session!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden