How to add keyboard in action sheet - iphone

Is it possible add keyboard in action sheet?
If yes, how can I do? ... I would like to disable the background.
Thanks, Luigi.

I think UIKeyBoard can not be added in ActionSheet but you achieve your goal but handling keyboard notifications...add the Keyboard will appear and will disappear notifications in your controller...
on keyboard will appear add a subview of frame same as the parent view frame..and set its alpha 0.5...it will look like An ActionSheet is appearing and the background will automatically be disabled and on keyboard disappear remove that view from superview...you can add tap Gesture in the view you are adding..Hope so it will be answer of your question.

You can add different controls to action sheets, like pickers and text views. However, as mentioned you can't add a keyboard.
If you want to customize what is shown when the keyboard is shown, you can slide controls with the keyboard, to make it look like they are part of the keyboard.
Alternatively you could create your own keyboard using buttons etc.

Related

Hide keyboard plus return key?

I have a view with a textfield at the top, a textview under it and two buttons below the textview.
The keyboard is configured with a "Done" button. Once the user has typed in their info, they click the save button, which is below the textview. First they click Done to hide the keyboard (and reveal the save button) then click the save button.
I need to allow carriage returns in the textview but "Return" is already taken up by Done.
How is it usually handled when you need a Return key and ability to also hide the keyboard?
Drag a button into your view, delete the text, and resize it to take up the entire view. In the document outline, select the new button and drag it to the top of the list of elements. This puts it in the background so it is not hiding the elements of your view.
Add this code to your ViewController:
#IBAction func hideKeyboard(sender: AnyObject) {
self.textField.resignFirstResponder()
}
Link the button to this action and you're all set.
If you're using a UINavigationBar or have other buttons or fields, activating any of those UIControls could be detected and used to dismiss the keyboard via resignFirstResponder(). In fact Save/Cancel/Done are UIBarButtonItems and are a standard mechanism for completing things and changing state, and create a framework for accomplishing what you want. If you don't take that approach then you have to get creative with how you do it, and also make it clear to the user what needs to be done.
In Interface Builder you can change the type of your main view from UIView to UIControl and then use addTarget() to detect touch events as a 'touch outside' area and use those actions to resign first responder as well. But you might want to consider a UINavigationBar or some other button bar or tab interface to make state transitions.
Also review iOS Human Interface Guidelines document. It's a great document for understanding how iOS is designed to handle common situations like what you are dealing with, and it can get you out of design ruts. It's well written and worth re-visiting periodically.

Adding smilies in Custom Keyboard

I want to add the smilies in the keyboard for text to add the comment like :P and <3 and if I did so to create the custom keyboard, will Apple reject my application?
You can add simple UIView with buttons above the keyboard, and show this view when keyboard appears. By pressing buttons just insert corresponding smiles to text.
if you are using something like UITextField, you can simply create a UIView with buttons like ":P",and assign this view to UITextField's inputAccessoryView property.

How to detect tapping on the gray (dimmed) background in UISearchDisplayController

I am working on a iOS project where I want to implement a search functionality. I'm using UISearchBar and UISearchDisplayController and I would like to make UISearchBar implicitly hidden. When user taps on the UIBarButtonItem, the search bar will appear and "becomeFirstResponder", whereas when user clicks on the Cancel button in the search bar, it should disappear.
The appearing is working correctly, but I have a problem with disappearing. I managed to hide the search bar when user taps on the Cancel button (searchBarCancelButtonClicked method), but I'm unable to hide the search bar when the grey (dimmed) background in UISearchDisplayController is tapped. As far as I know, there is no method to detect this event, so it is necessary to apply some hack. Do you know any, or what is the best way to detect tapping on the gray background?
So I've finally worked it out. Apart from the searchBarCancelButtonClicked:(UISearchBar *)searchBar, it is also necessary to hide the search bar in searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller. It looks this callback is called even when the gray (dimmed) background is tapped, so it can be easily used for hiding the search bar.
UISearchDisplayController usually consists of a UISegmentedControl, the UIResultsTable and the keyboard. The results table is where you want to detect this touch to dismiss. With that being known, maybe you can add a transparent UIButton to that view that dismisses first responder, or Maybe you can add a UIGestureRecognizer on a transparent view that achieves the same effect? Just thinking off the top and have not tried this myself, if it works for you im glad !

How to put a small custom toolbar above the Keyboard that moves up and down with it?

How to put a small custom toolbar above the Keyboard that moves up and down with it?
Use a Keyboard Accessory View. Here is a sample project

Display keyboard above toolbar?

I have a view with a bottom toolbar and a UIWebview that is loading an HTML page with some textboxes. Is there anyway when the user clicks on a textbox, the keyboard appears above the toolbar, that way it doesn't hide its buttons?
You shouldn't try to change the keyboard's location, even if you could. That would be a usability disaster.
Instead, try to move the toolbar above the keyboard if you want to keep it visible.