I am using a UIView to show a form with a text box(text), text box (want to attache this with datepicker) and text box (attach this wit picker to select multiple values)
I want to show date picker on click on text box but when I click on the texbox,it start showing the keyboard at bottom.
Will it be good to use read only textbox for date picker value or should i user table view for my form. Please suggest a link for that
I'm assuming you mean UITextField when you say text box. Check inputView property of UITextField. You can add a custom view instead of the keyboard.
Related
I have embedded a ScrollView within a UIViewController which contains multiple text fields that will act as a simple form to collect user data (Name, email, etc.). The problem is that when a text field is selected and the keyboard slides up, the text field is obscured by the keyboard. How can I slide the text fields back into view so that the user can clearly see what they are using as input?
You have to check for uikeyboard visibility ( see this post How can I programmatically check whether a keyboard is present in iOS app? ) and then call scrollRectToVisible for the selected textField. If you google about uikeyboard and scrollRectToVisible you will find many tutorial about this problem...
I am working on implementing something in my iOS app that I see in mobile websites all the time. I would like to have a TextBox or TextField of some kind that shows what value is currently selected. When clicked, it will present a UIPickerView with a list of possible choices. Upon selection, the UIPickerView will disappear, and the TextBox or TextField would get updated with the selection the user made. Can someone point me in a good direction for doing this?
You can save indexPath value in a string and show it on textfield like: [textField setText:NSString];
How can i display a picker and textfield on the same box, like it appears when you add a contact on the telephone and email fields.
Tried searching for a solution, but could not find anything.
you can manage that view by making customView. and set it`s frame above your pickerView. on editing text(if keyboard) and didselected(if picker) set text of that textfield.
this is exactly like adding toolbar on keyboard or pickerview...
hope u got idea...
I need to get the cursor in textfiled but on the textfileddidbeginEditing i have to open the picker view for selection , so for that reason i need to resignFirtsresponder to the textfield ,inorder that picker view is visible .But by doing this the cursor gets disabled as i open the picker (and the keyboard gets hide by resignFirst responder).I want to show the cursor as because when user cliks on partilcuar textfield so by that cursor he can track on which textfield he is making the selection.
Hope i am clear with my question.
if you want the picker instead of keyboard, set the text fields inputView as the picker... so when you tap the text field the picker will pop up like keyboard and the textfield will show the cursor too.. no need to dismiss the keyboard and then show the picker..
If I understand your problem right, this is just an usability problem. I think you can solve this if you just add some other mechanism for showing the user which textfield is in editing-mode.
For example add an text-color to the TextField. If the user disable the UIPickerView set the text-color back to the normal state.
i'm having one text field, normally when touch the text field, keyboard will appear, is it any possibilities where when text field is touch one drop down list will appear to recommend value to be enter and value is selected it will appear in texr field
thanks
There's no automatic way of doing it but it is possible.
You would use the textFieldDidBeginEditing: delegate method of the UITextField to display a UIPickerView to your view. (You could also use textFieldShouldBeginEditing: depending on what you wanted to do.) When a user selected an item in the picker, you would add code to copy the appropriate text to the text field and, presumably, hide or delete the picker. You'd also need to hide or delete the picker when the text field lost focus.