Attachment action sheet hidden behind keyboard in iOS 9 - uiactionsheet

If the keyboard is shown in the chat view controller and you tap the photo attachment button, the action sheet for the photo options is hidden behind the keyboard. If the keyboard is hidden/dismissed and you tap the photo button, you can see the action sheet just fine.

call this method
[self.view endEditing:YES];

Related

What is the correct approach for dismissing the keyboard when using a UITextView?

I am wondering what the best approach for dismissing a keyboard is when using a UITextView. At the minute for UITextFields I dismiss the keyboard when the return button is pressed. However for the TextView I want to have the return button actually add new lines so there is no additional buttons remaining to close.
What if any is the current "standard" approach for dealing with this issue? For example is it to add an additional button on the screen or is there another approach?
Thanks
On the iPad there is a "dismiss" button on the keyboard. For iPhones, add an inputAccessoryView to the UITextView. Put a "dismiss" button there.
If you have several fields (text fields, text views, etc.) in some sort of form, you could have a standard inputAccessoryView for all of them. Include a "Next" button (to go to the next field) and a "Done" button (to dismiss the keyboard).

How to hide the toolbar when user taps an action in a CNContactViewController?

This just started happening with iOS 9.
I have a CNContactViewController that displays a contact for the user to edit and save. I also have toolbar buttons at the bottom of the screen by calling setToolbarItems.
The problem is that when the user taps "Add To Existing Contact", the toolbar buttons stay on the screen and cover the bottom of the contact list that shows up, so the last contact on the list can't be tapped.
Similarly if "Share Contact" is tapped, the toolbar buttons cover most of the "Cancel" button, so the word Cancel can't be read and it's hard to tap.
Is there a notification I can use to know when to hide the toolbar buttons?

Custom Button as a Navigation Button

I have a custom button like facebook app does. When I click on custom button while editing my textview, it shows left menu but doesn't hide keyboard.
I have tried everything but still my problem is there. How I can hide keyboard on clicking on custom button.
Just include this in the burger's button IBAction
[self.view endEditing:YES];

UIActionSheet does not prevent external, "under" touches

I have a UIBarButtonItem in a navigation item that displays a UIActionSheet with a button to toggle a quick setting:
The action sheet is presented from the button item:
[calendarSettingsSheet showFromBarButtonItem:self.navigationItem.leftBarButtonItem animated:YES];
However, here's the problem I'm encountering:
When I tap below the navigation bar, for example anywhere in the calendar, the UIActionSheet dismisses, which is expected. Any touch outside the sheet, in my opinion, should dismiss it.
But: I can still tap on the "Settings" and "Done" buttons in the navigation bar, and not only is the action sheet not dismissed, but the buttons function.
So, tapping "Settings" while the UIActionSheet is open, causes another to be opened. This can easily be avoided by checking to see if the action sheet is already open.
But, the "Done" button dismisses the entire calendar view, leaving the UIActionSheet hovering over the view that originally presented the calendar.
Is this intended behavior? While I could disable the buttons when the action sheet is presented, and enable them when it's dismissed, this seems like an unnecessary workaround.
Is this intended behavior?
Yes.
From the documentation of showFromBarButtonItem:animated:
On iPad, this method presents the action sheet in a popover and adds the toolbar that owns the button to the popover’s list of passthrough views. Thus, taps in the toolbar result in the action methods of the corresponding toolbar items being called. If you want the popover to be dismissed when a different toolbar item is tapped, you must implement that behavior in your action handler methods.

How to send open uikeyboard back while opening other subview?

In my application I have one uiview.
I am adding another subview to this view which contains one textfield.
when user clicks that field then it display the keypad.
This subview also contains one add and delete button.
when user clicks on that button another view is opened which is also the subview of main view and that view contains selection list in the table.
The problem here is when user types something in textfield so keyboard is open.
if user does not dismiss that keyboard and clicks on add button to select from selection list then only half of the selection list is visible because keyboard is still open.
I want to send the keyboard back.
Here i do not want to dismiss the keyborad.while user clicks the add button.i only want to send it back to the selection view.when user is done with selection view keyboard should be open as it is.How can i solve this issue?
If you want the keyboard to go away, you need to dismiss it when they click on the button by using [yourTextField resignFirstResponder];.
If you want it to come back when they select an item, you will need to call [yourTextField becomeFirstResponder];.

Resources