How to scroll within a ScrollView while keyboard is present? - ios

I have a ScrollView and two buttons, one is at the top of the view and the second one is set lower than the height of the keyboard. By changing the inset, I now have the ScrollView move up once the second button is pressed and the keyboard is shown. However, after I press the second button and the keyboard moves the ScrollView up, I want to scroll the view up with a touch to be able to see the first button (without closing the keyboard). But whenever I try to pull it up the keyboard disappears. Any thoughts?

Related

How to tap a view that's underneath another view with voiceover

I have a UICollectionView with a contentInset at the top.
In the contentInset area, is the Top View. The top view is physically behind the UICV, with hit testing that passes the touches through to the TopView. ie: Touches in the TopView area pass through the UICV and are recognized by the TopView.
However the when tapping in the TopView with the accessibility inspector (or in VoiceOver mode on device), it selects the UICollectionView
Is there a way to make VoiceOver select the TopView in my example?

tvOS 10 - make the only button in a UIScrollView to go out of focus when scrolled past it

I am working on a tvOS 10 project, with Xcode 8 and Swift 3.0.
I have a scroll view that has 2 views under it. In one of these views there is a button, the only button in the entire scrollview.
The scrollview scrolls fine, but when the button comes on focus, it does not go out of focus anymore. I can still scroll past the button. But the button stays still in focus (zoomed out), I can not press it but it is in focus. I can only press it if the the visible view is really on top of the button.
This is pretty much all the code I have in viewDidLoad()
// Set the scrolling content
scrollView.contentSize = CGSize(width: 1920.0, height: 2800.0)
// makes the labels focusable, so it will scroll.`enter code here`
scrollView.panGestureRecognizer.allowe[![enter image description here][1]][1]dTouchTypes = [
UITouchType.indirect.rawValue ]
scrollView.directionalPressGestureRecognizer.isEnabled = true
I want to make it so the button stays in focus as the scroll view is passing the button. But once the scroll view goes past or above the button, I want to be out of focus. So, if the user scrolls back down again it will come on focus.

iOS keyboard appearance messing up other view

I have UITextField, UIButton and UIImageView inside my view. On viewDidLoad I am animating (moving up) button and image and setting them on some specific position. But when user taps on a textfield to edit it, as the keyboard appears the button and image move back to their original positions.
I don't want any view to move back after my animation finishes. The keyboard appearance is messing up my views. Why its happening or how can I prevent it from happening?

Present UIPopoverController from a moving rect

Just got this weird problem, where I have a scroll view and buttons in the scroll view. I want to display a UIPopover from the button when touched, with UITextFields inside the UIPopover. The problem comes when the Keyboard appears. In certain cases, when the UIButton is so high in the view that the popover can only be displayed under it with the UIPopoverArrowDirectionUp, and when keyboard pops in, this popover cannot move any more up and therefore magically disappears to the top left corner (probably some Apple thing).
My solution is to check the frame of the UIPopover and to check that there is enough space for the keyboard, and if not, scroll the UIScrollView up with the buttons as well in order to be able to push the UIPopover up and so make sure that both the Keyboard and the popover fit.
So the question is: Is it possible to move the popover as the button moves?
Thanks

How do I make my UITextView autoscroll when dragging caret to the edge of view?

In the iOS's Notes app, I wrote very long text on the TextView,
then I long press on the view, bring up the magnifier loupe, drag it to the bottom of screen (or top of the keyboard, if it is activated), the TextView will automatically scroll up.
How can I implement this with UITextView?
I tried
Add a UILongPressGestureRecognizer to my UITextView subclass, but its action never get called.
Override touchesMoved:withEvent: method in my UITextView subclass, but this method will not be called after the magnifier loupe appears.
You don't implement it; that's standard behaviour.
The magnifier scrolling occurs when you drag the magnifier off the bottom or off the top of the UITextView, or when you're close on the edge, about 10 pixels? (best to test this in the simulator where to have exact-control over the touch-position). If your text view is full-screen you may not be able to drag to a position outside the view, and the touch-region for scrolling may just be too small.
Notice in the Notes app that to scroll down you can drag the magnifier onto the tabs at the bottom. To go up you can drag it into the title. So long as you hold the touch outside the view it'll scroll.
All this also means your view can't go behind the keyboard when it's present. You need to resize the UITextView when the keyboard appears to get the scrolling to work.

Resources