Dismiss iOS form sheet modal via outside tap + VoiceOver mode - ios

On an iPad, you can use controller.modalPresentationStyle = UIModalPresentationFormSheet to show a centered modal on the screen. A common technique is to allow the user to dismiss the modal by clicking "outside" or "behind" it. This is covered in numerous other answers (Iphone SDK dismissing Modal ViewControllers on ipad by clicking outside of it,
Dismiss modal view form sheet controller on outside tap), usually by adding a tap gesture to the view's UIWindow.
My question is, how do I make this accessible to users in VoiceOver mode? The native action sheets allow clicks outside the sheet to dismiss, and even prompt the user, saying "double tap to dismiss popup window". How can I expose the UIWindow tap gesture in the same way?

From Apple:
https://support.apple.com/guide/iphone/learn-voiceover-gestures-iph3e2e2281/ios
Dismiss an alert or return to the previous screen: Two-finger scrub
(move two fingers back and forth three times quickly, making a “z”).
If the modal sheet is opened, we can prompt the user to "make a z gesture" to go back.

There is basically no way to do this with the FormSheet presentation. You can use the Popover presentation, but it behaves differently in some cases.
My solution was to check UIAccessibilityIsVoiceOverRunning() and add an extra close button element to the top of FormSheet that can be clicked via voiceover. I also implemented accessibilityPerformEscape for the global escape gesture.

Related

iOS modal interactive dismissal freezes

I have created a UIPercentDriven Transition which modally presents a popover view containing a tableView. Then, following stack exchange posts such as this one: In iOS, how to drag down to dismiss a modal?, I added a panGestureRecognizer to control the dismissal of the modal view. Then, I attempted to add functionality so that the user can continue to swipe downward once the tableview has reached the top to trigger the percent driven transition.
Here is a link to the project on github:https://github.com/KaplanAlex/modalViewDismissal
This transition was based on moving the frame of the modal view off of the screen. I also created the transition by using snapshots (which is commented out in the github project) and have the same issues. For some reason, the interactive dismissal works well unless the user moves the modal view back up after starting the dismissal and then continues to swipe upward after the modal view has reached the top of the view, the entire application seems to freeze. It doesnt crash, but also doesnt respond to taps anywhere on the screen. Even cancel button cannot be pressed. Has anyone encountered this issue before? Thanks for the help.

iOS - Swift - How to display UIAlertViewController without disabling background

I wanted to display a Popup view on top of the screen but while enabling the actual screen as well. User should be able to perform all touch actions on the screen's controller while displaying and allowing touch actions on popup view as well. No fade for background ofcourse.
I do not see a existing style for UIAlertController that meets this need.
Is it possible with UIAlertController?
(PS. with UIPopoverPresentationController Custom style, managed to disable fade but still couldn't get the touch controls work on background screen)
Sounds like you might want to look into passthroughViews property on UIPopoverPresentationController. From the documentation:
"When displayed, taps outside of the popover window cause the popover to be dismissed automatically. To allow the user to interact with the specified views and not dismiss the popover, you can assign one or more views to the passthroughViews property."
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPopoverController_class/

Why iOS default did not support auto keyboard dismiss function?

while I develop iOS application with swift, I wondered why apple did not support auto-dismiss keyboard function in application. This means if I implement a TextLabel on screen, I tapped that label, Keyboard appears, but did not dismissed automatically.
I thought many of application keyboards need to dismissed when users tap on outside of the keyboard screen or click 'done' button on a screen. However, basically, I have to implement keyboard dismiss function on every ViewController. And I think this is code duplication.
Anyone can explain me about apple's application method implementation philosophy and how can I wrote an reusable function, which is not duplicated function in every ViewController scheme.
Transposed from Comments:
In general apps where the main function utilizes the keyboard would rather control when the keyboard dismisses themselves instead on relying on an auto feature.
Ex: For a texting app after I click the send button I would like to send another text. Then I shouldn't dismiss the keyboard.
If you are dismissing the keyboard multiple times than I would try making a view controller class that handles that and subclass it. You can observe when the keyboard is shown and add a button on top of your view so when it is clicked the keyboard dismisses using [self.view endEditing:YES];

pop view controller with enabled/open keyboard in ios 8

i am trying to implement some chatroom-like view controller (e.g. Messages-app on iPhone), and i would like to keep the keyboard enabled/open when this (chatroom-like) view controller gets dismissed and therefore gets popped from the stack, BUT dismiss it together with the view, i.e. sliding it out of the screen together with the chatroom-view-controller.
For the desired effect, just open the Messages-app on the iPhone, go into one chatroom/conversation, set the focus on the input-textfield so that the keyboard comes up, but then go back to the last view without dismissing the keyboard.
I always get this weird animation that the chatroom-view (-controller) is sliding out of the screen to the right (which is desired), but the keyboard gets dismissed to the bottom of the screen...
Does anyone know what I am doing wrong? I have already tried it with so many versions, from become/resign first responder in all the different view will/did appears...
My assumption is that it could have something to do with my custom pan gesture recognizer for popping the chatroom-view-controller from the stack of the navigation controller, but neither the docs nor the web contain such issues...
you don't need to keep your keyboard visible, instead you can make snapshot of chatroom controller right before it being dismissed.
Edit: I just created simple app with navigation controller which pushed controller contains text field. Then on app tried to pop that controller when keyboard is visible. And..all view was dismissed together with keyboard, so your wanted behaviour is given by default.

iOS connect my view to popup on button press

I have two xibs, one is my title screen with buttons, the other is a more specific window that should come up when one of the buttons is pressed.
This isn't switching the whole screen, just a popup window, where clicking outside of the bounds of that window will make it disappear leaving only my title screen remaining as it was visible behind this popup view. This is similar to my understanding of "modal views".
Anyway I do not quite get how to connect it to the button on my title screen. I have the views made in IB ready to go. I'm not sure if I have declared all objects to satisfaction yet.
From what I understand I think I need a UIViewController or something, but its all a pretty thick fog of information right now
insight appreciated, or links to proper noob sources would be helpful
Does your title screen have a view controller (or is your app delegate the main controller object)? You will want to add an IBAction to that object, connect the button to it, and then present your other view controller modally (or in a popover) from there.
A popover will appear in a small window with an arrow, and tapping outside will close it. A modal view controller typically slides up into place, and you have to press a cancel button to close it. This guide explains how to use a popover. Using a modal view controller is simple if you have a view controller: [myViewController presentModalViewController:nextViewController animated:YES].

Resources