Hide option menu when UITextField text is selected - swift

Simply how do we prevent this pop up menu when UITextField text is selected.
Desired functionality:
user can tap either field and edit text.
When field is tapped and textField is empty, i have text generated then textfield.selectAll(self). This is the point that the menu pops up.
How to disable UITextField editing but still accept touch? answers do not resolve this issue nor allow user to still use the textField.

Found the response:
https://stackoverflow.com/a/21716228/2129911
When using textField.selectAll(), passing the textField's delegate makes the pop up menu appear.
For no popup menu use textField.selectAll(nil)

Related

how to get the cursor in UITextView without keyboard?

I am developing a program in which I have UITextView in that I need a cursor without the key board.In this cursor is show only with the keyboard if I hide the keyboard cursor will also get hide.How can I get the cursor without the key board ?
The cursor is displayed as long as you UITextView is being edited.
Thus, you can change its inputView view to some other view if you need to, and it will be displayed instead of the keyboard.
See http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIResponder_Class/Reference/Reference.html
With this method you can add your custom inputView, a UIPickerView for example, or as you say you want you can add a minimalist hidden UIView.
If you want to restrict UITextField content, you still need to implement UITextFieldDelegate, as the user can still paste content to your text field!

How do you keep the keyboard visible after you click the Send key

In my iPhone APP I have a view with a textfield and a button (to remove the view).
My main goal is to have the keyboard always visible.
I made a "Send" button visible on the keyboard and am able to capture when the send button is pressed.
Hoever, when you press the send button the keyboard is removed. What I would like is for the keyboard to remain visible and the text from the textfield to be cleared and be textfield to have focus ready for some more typing.
Adding:
[textChat becomeFirstResponder];
in the Did End On Exit event does not work. I am not sure if I should be using one of the other events.
There are a ton of samples and tutorials on how to remove the keyboard, not one on how to keep it.
The keyboard is removed when it stops being the first responder. There is a delegate method you can implement, textFieldShouldEndEditing:, which is called when the text field is asked to resign from being first responder. You could implement this and have it return NO after you do whatever you want to do with the data in the text field (send it somewhere), clear the field, etc.

get cursor on textfield

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.

UItextfield auto labelling

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.

How to display key values in toolbar which is on keyboard

I am developing one application. In that I have toolbar on keyboard. But I want that when I press keys, the key values should be displayed in toolbar textfield.
So if anyone knows kindly reply.
Have you added a UITextField to your NIB or view? That is the best way to get a keyboard displayed and enter text. You can then retrieve the text using UITextView's text property.