I'm trying to scroll a textview programmatically using the scrollToPoint method. This works fine if the textview has a scrollbar, but if I disable it with setHasVerticalScroller:NO, I get some strange results: if I try to scroll using the two-finger gesture after the programmatic scroll, the textview automatically jumps back to the point that was shown before the programmatic scroll. I already tried redrawing the textview and actualizing it, but nothing worked.
Related
I have a scrollview that has a bindable stacklayout inside it with a Item template that is using the drag and drop gesture recognizer. This works no problem but on android the drag gesture recognizer fires off immediately as soon as you start scrolling the screen. I'm curious if anyone has any ideas on how to handle keeping the gesture recognizer but also allow for the user to scroll the screen without dragging around an item in the list.
I have a modal window, which is perfect for iOS 13's drag to dismiss gesture, because this way the user remains in the context, so I don't want to use full screen. The controller contains a UICollectionView which displays a month calendar, which is scrollable vertically.
The problem is, that when the user wants to scroll upwards in the collection view, the dismiss gesture is triggered instead. If I scroll down first, then can I only scroll up.
I've tried to disable the internal UIPanGestureRecognizer (it seems somehow there is no presentedView, so it didn't work), tried to set the UICollectionView's pan gesture recognizer delegate to prevent the system recognizer to fire (it turned out you can't do that), and tried to scroll the collection view on appearing a bit (ugly).
How can I elegantly convince the the modal presentation, that my scrollview isn't scrolled to the top?
I have a project with a UIScrollView which I want to control the zooming programmatically but not via user interaction. I have tried setting the multipleTouchedEnabled property to false. This doesn't work. When I pinch on the scroll view, the scrollViewDidZoom and viewForZoomingInScrollView are called. I have also tried subclassing UIScrollView and overriding addGestureRecognizer and disabling the gesture which passes a [gesture [isKindOfClass: [UIPinchGestureRecognizer class]]. After breakpointing on that override, no gestures are matched.
So how can I have zooming on the scroll view but not allow manual interaction with the zooming. I still need single finger panning for normal scrolling.
Try to set scrollView.pinchGestureRecognizer.enabled = NO;
The question is very simple, how to enable scroll and zoom inside a UIScrollView in tvOS?
I tried the same initializer code from iOS and returned the scrollview for the focusedView var, but nothing happens when i touch the remote.
Also, i tried to add another custom UIPanGestureRecognizer to the scrollview and actually it works, but i don't want to handle the pan with custom code, just use the same pan behavior like iOS.
Let me know, thanks.
You can configure the scroll view's built-in pan gesture to recognize touches on the Siri Remote. It doesn't do that automatically, because normally scroll views on tvOS aren't scrolled directly by touches: they're scrolled automatically as focus moves between views within the scroll view.
If you really want the scroll view to move directly from touches, you'll need to add UITouchTypeIndirect to the allowedTouchTypes of the scroll view's panGestureRecognizer:
scrollView.panGestureRecognizer.allowedTouchTypes = #[ #(UITouchTypeIndirect) ];
You'll also need to make sure that either the scroll view itself is the focused view, or is a parent of the focused view, since all touches from the remote will start at the center of the focused view: you need to make sure the scroll view is getting hit-tested for the events to work.
Zooming won't work, because the Siri Remote can only recognize one touch at a time, so you can't do a pinch gesture on it.
Swift 4 version (from here: https://stackoverflow.com/a/41000183/945247)
scrollView.panGestureRecognizer.allowedTouchTypes = [NSNumber(value:UITouchType.indirect.rawValue)]
Hi I have a vertical UICollectionView that works just fine, but the las item is barely visible and you have to pan up the scrollview to fully be able to see it, when you stop panning the item bounces back and you can almost interact with it.
I've tried with the bounces properties in the collection view's properties for scrollview in interface builder, but it's still the same.
Should I have to increase "manually" the scrollview's contentsize in order to let me interact with this item?.
You can barely see in the following screenshot, at the bottom just below 25th July
Just a guess here, but maybe your navigation bar is "pushing" your UICollectionView down.
Are you sure the frame of the UICollectionView is right? Maybe it is extended off screen.