I have UIWebView integrated in my app. When I'm clicking on text fields inside it keyboard with 3 toolbar button called (<, > and Done).
Is it any way so add custom buttons to that toolbar?
you can create a custom UIView to instead the inputAccessoryView. After that, add your custom buttons on the custom UIView。
Related
I want to add a cancel button to hide the keyboard if the user wants to. I cant find any solution for swift 3.
Take a look at the documentation of a UITextField's inputAccessoryView: https://developer.apple.com/reference/uikit/uitextfield/1619627-inputaccessoryview
Assigning a view to this property causes that view to be displayed above the standard system keyboard (or above the custom input view if one is provided) when the text field becomes the first responder. For example, you could use this property to attach a custom toolbar to the keyboard.
I recommend to assign a UIToolbar that contains your cancel button to the inputAccessoryView of the UITextField that needs the cancel button. Then hook up an action to the button that resigns the first responder from the UITextField.
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];
I need to show UIKeyboard with done button on top right corner ..please look into attached image..any help would be appreciated.
This might help you. please check it out BSKeyboardControls
Create a UIToolbar keep two bar buttons in that. Initially Hide that toolbar.
Show the toolbar on the textfield didBeginEditing delegate of textfield
and hide the toolbar in didEndEditing delegate of textfield
EDIT: As prashant said BSKeyboard offers what i said. See the look and feel of it here http://www.cocoacontrols.com/platforms/ios/controls/bskeyboardcontrols
You should set inputAccessoryView propery of UITextField or UITextView to your custom view with all required buttons
#property(readwrite, retain) UIView *inputAccessoryView
Description
The custom accessory view to display when the text field becomes the
first responder The default value of this property is nil. Assigning a
view to this property causes that view to be displayed above the
standard system keyboard (or above the custom input view if one is
provided) when the text field becomes the first responder. For
example, you could use this property to attach a custom toolbar to the
keyboard.
This has been bothering me for few weeks.
Here's a screenshot:
I copied this view Controller from a sample project.
Now I need to replace the Textfield with a UITextView instead.
The problem is I can't seem to be able to drag and drop it to a Bar Button Item.
I literally removed the textField then tried to drag and drop the textview, the Bar Button Item just wont highlight.
What am I missing?
PS: it works with UITextfield only.. why ?? o.O'
I think you are referring to the inputAccessoryView, it's a UIView which gets displayed when the textview becomes first responder. hence when the keyboard shows.
You can customize the UIView to hold all controls you want: textview, buttons, etc. More details here.
Basically, you implement your custom keyboard tool bar which is a UIView subclass (I assume you want something like the messages app), then you set the custom UIView to the inputAccessoryView property of the UITextView. here is a relevant link to get you started: http://gabriel-tips.blogspot.com/2011/05/input-accessory-view-how-to-add-extra.html
I have a subclass of UIToolbar. I created it because I have the same toolbar on multiple pages(UIViewControllers). I took UIToolbar on my UIViewControllers (I am using storyboards) and assign this subclass to the UIToolbar class.
Also each item on that toolbar is created with a custom view (UIButton). When I change one of the items from its subclass, it's not reflecting immediately on the toolbar. I have to go to another screen and come back to view the updated result.
Is there any way to update immediately? Thanks.