I have tool bar as input accessary view and datepicker as input view for my date textfield.
Hotel booking label is behind that datepicker. When I touch on date textfield, It shows both input view and accessary view as I need. But what is the reason for that transparent space between input view and accessary view.
This issue started from Xcode 9.
Note :
When I copy date picker and toolbar from old projects then there is no transparent space. Its working as we expected. But When I drag date picker and toolbar from xcode 9 and above then there is a transparent space.
Please help me to fix this issue. Thanks in advance.
Also faced with this when drag from the object library toolbar and date picker to the storyboard.
Input view allows set your own view above keyboard. In portrait mode keyboard's height is 216. I've changed height of of the date picker from standard 162 to 216.
Need think more about why when copy from old projects there are no space between accessory view and picker.
Related
I can't seem to find how I could replace the keyboard when I tap a textfield in the following context:
I have a view controller with a tableview dragged into it with one prototype cell, and in that cell I have 4 textfields. As for my swift files, I have one for the table view (view controller) and one for the cell itself.
I was able to replace the keyboard with a datepicker for one textfield, but do not know how to proceed for a picker view...
Thank you in advance for any help/advice given! Please let me know if you need more detail.
Cheers,
Laroms
As far as I understand, you are asking to change the input type of the UITextField.
You can make use of inputView property of the UITextField. Set the inputView for the required textField as UIPickerView. It'll automatically change the input type.
I have the following problem: I have a standard UITextView which I resize once the keyboard pops up. I also have another view which I animate into view (not the standard accessory view attached to the keyboard). The problem is that I do not want text to be hidden by this view. This is what happens when I reach the last line (orange view = my custom accessory view):
Ideally, I'd like to have an automatic scroll should that happen. But I have no clue how to achieve this if I am in the last line of the UITextView. Also, scrollToVisible doesn't work in this context and I don't know if I'd get anywhere with contentInset.
Any suggestions would be welcome! Thanks.
EDIT
I suppose I would need some kind of mechanism which would allow to
make the textview only expand to the line right above the accessory view if I was entering something on the LAST LINE
have the textview expand to the keyboard if I was not editing the LINE DIRECTLY ABOVE the KEYBOARD.
Does that make sense? What I need is the opposite of contentInset, I suppose.
I simply don't want to resize the textView to just above the accessory view as it takes away screen space to display text.
I got the solution- sorry, I guess it was obvious, but it took me the whole day to figure it out:
textOfPage.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
This will offset my UITextView so that the last line is never hidden. The 100 is in pixels and can be adjusted accordingly.
What I would do is resize the textview in the textViewShouldBeginEditing method to fit above the keyboard and the newly added accessory view, and then resize it back to full screen when the keyboard is dismissed in textViewShouldEndEditing
I have looked everywhere and I could not find a 'good' solution to display a uidatepicker when a tableviewcell is tapped. In the following screenshot, the datepicker slides up from the bottom and the background of the view is dimmed. There are done and cancel buttons on the toolbar within the view that holds the datepicker.
appreciate your help
If you're targeting 3.2 or higher, just assign a view containing the picker and whatever buttons you need as the cell's inputView, override the cell's canBecomeFirstResponder method (if necessary) so it can become the first responder, and call becomeFirstResponder on it when tapped.
If you're still targeting earlier versions, you'll have to add that view with the picker and buttons to the hierarchy, animate the sliding, and so on all manually.
I am working on a navigation based app. every cell has a detail view. i have textView in detail view which shows details of selected cell. is it possible to add a facebook like icon in the end of textView? and if no then how should i do that. thanx in advance.
You can put the icon after the textview, or you can overlay it on top of the textview. It's as simple as putting it there in interface builder:
or, just set the frame properties of the text view and the image view to overlap, and place the image view on top of the text view (simplest way is just to "addSubview" it 2nd, which will place it on top).
I have a UITableView that contains text field in each row. The text field is allowed to take only numbers and decimals. I have a transparent background button to help users click on the view to dispose the keypad when it is up. The text fields at the bottom of the view are getting covered by the keypad, so I wanted to move the view by capturing the textDidBeginEditing method etc and animating the view upward. The problem I notice is that after this code to move the view was added, if the numeric keypad is up and if I click on the view outside the keypad to dispose it, the background button does not receive the event so the keypad is not disposed. Can this be fixed? Thanks
I think the problem is the button does not cover the entire view. For your convenience you can make the button non-transparent and have some image on it to see its size.
Confirm the button is on the top of the view layer order.
Also confirm the button is there on the view after the view animation.