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.
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 want to always display keyboard in all views in pageviewcontroller.
All views have uitextfield and I coded becomefirstresponder in viewdidload so the keyboard appears.
But problem is that when i set new viewcontroller or swipe in pageviewcontroller the keyboard disappears and re-appears.
Can I always show keyboard?
Thanks.
Go simple.. set invisible textfield (means hidden one)! Set that as a first responder basically, this text field should be in base view controller means out of page view. as soon as you swipe the page shift responder to the required text field. hence it will not disappear and appear on page shift.
UITextField resigns as first responder on any tap/swipe gesture. You need to handle it in your scrollview delegate method when you detect the scroll ended and then set the current page view controller's UITextField as first responder.
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 am looking to have a UITableViewController that has a TableView with 2 sections and a tabbar/toolbar that holds two buttons, 1 share button and the other is a button that pushes a view controller. The table view should be underneath the tabbar/toolbar (or the frame should not go under the toolbar/tabbar). If toolbar/tabbar is not possible having a image/button I was thinking of making a view to have as a subview.
Here is what it should look like:
If anyone has any suggestions or ideas of how to go about this, any guidance would be appreciated. Thanks in advance!
First of all you want a UIToolbar not a UITabBar.
Secondly the only kind of element UIToolbar can hold is UIBarItem, specifically you are interested in its concrete subclass UIBarButtonItem.
UIBarButtonItem can either be a system item or hold a custom UIView. Since UIButton and UILabel are all subclasses of UIView you can place them inside a UIBarButtonItem and add this item to the toolbar.
Yes,you drag a tabbar to your viewcontroller, an then drag buttons or other things inside of that tabbar.
I'm showing a normal ViewController. Now i will tap on a button and all i want to see is like the following image:
In this image, the background is my root view controller and when i tap on the button, an image view that include black color(alpha = 0.8) will put on top and show my Custom View. In my Custom View, when i tap on DONE button -> the content of textField1 and textField2 will send back to rootViewController and hide my Custom View.
So, could you please help me for solve my situation? Tks in advance.
You can use the delegate & block programming to send the data back to the root View Controller.
Its simple, In Interface builder, Add a UIImageView to the view, and a UIView and connect them both to your .h file. Then set the imageView's values and buttons in custom view and And in your viewwillappear method in .m file, set them hidden using [imageView setHidden:YES];
And when you want to show them just set your setHidden to NO and you should be able to see the customView.