How to set the popup keyboard to only show certain keys? - iphone

How do you set the popup keyboard to only show certain keys when you type into a textfield? I know there are default keyboards but none seems suitable. Is there an alternative input option? Thanks.

Since iOS 3.2, you can change the keyboard :
cf.
Official documentation here
Discussion
The value of this property is nil.
Responder objects that require a
custom view to gather input from the
user should redeclare this property as
readwrite and use it to manage their
custom input view. When the receiver
subsequently becomes the first
responder, the responder
infrastructure presents the specified
input view automatically. Similarly,
when the view resigns its first
responder status, the responder
infrastructure automatically dismisses
the specified view.
This property is typically used to
replace the system-supplied keyboard
that is presented for UITextField and
UITextView objects.

Apple wont allow you to do any alterations to the keyboards..
What do you want to enter? Either create a custom keyboard, use pickers if possible or code it to not accepts certain keys..

Okay. I did'nt know you were allowed to change the keyboard now..
I usually use a picker. and have one of the segments just contain a "," the rest of the segments are 0-9..
or you could do something like this:
What is the best way to enter numeric values with decimal points?
But since its okay to change the keyboard now try this:
http://blog.devedup.com/index.php/2010/03/13/iphone-number-pad-with-a-decimal-point/

Related

how to detect a password text field when running in the background?

I am developing a screen recorder and facing a crazy requirement. My boss would like to have an option for a user to automatically pause recording when the current view has a password field. (That view might belong to a third-party app.)
So, is it possible to check if the topmost view has any password text field?
This is an enterprise app so private api is allowed.
Any pointer from jailbreak community is also welcome.
It would be much easier if you could just use your own views but this should work for either your own views or a third party view. BUt anyway, every time you would load up a UIView check all of its subviews, in the ViewDidLoad Method i would think and for each subview check for its class type in your case it would be UITextField. Since these are the only textfields where you can set secure text entry as its text type. Every time you find a UITExtView check if its secureTextEntry is equal to TRUE. If it is true disable the recording until that view is removed from the screen. That should be what you need.

Is it possible to create a fully customised keyboard for iphone?

I want to do a customised keyboard. Either
1. Create a view with all the buttons similar to default keyboard present but with some changes in the controls.
OR
2. Is it possible to change the color of already present keyboard or its alphabets/numbers.
Is it possible to do either of them? Is there anything similar to this?
Yes, you can, and it's not difficult. In iOS versions 3.2 and greater, you can set the inputView property for any responder. When that responder becomes first responder, the input view will be displayed.

Is it possible to change the default InputView in MonoTouch?

I would like to display a different view than the standard keyboard (a picker control, or a date picker, for example) when a text field becomes first responder (i.e. gets focus). This would be really nice, because currently I'm pushing a custom view which contains my picker control onto the navigation stack where the user chooses an option, and then hits an OK or Cancel button.
According to the documentation for UITextField.InputView:
Assigning a custom view to this
property causes that view to be
presented instead.
But, It's read only!!!
Is there a workaround for this? Do I need to implement a custom UITextField control and somehow override the InputView property? Do I need to call some kind of native function? I'd really love not to have to do either of those things... but if I have to, so be it. Thanks in advance!
The documentation is slightly out of date. There is a setter since MonoTouch 3.2.0.
Kevin's answer will work for UIKeyboardType keyboards but as far as I'm aware (I could be wrong) you can't present a custom keyboard this way.
The only way I know how to present a custom keyboard is to override the InputView for the UIViewController you wish to present the input view.
UIView keyboardView;
public override UIView InputAccessoryView {
get
{
// create the view as you'd like here
return keyboardView;
}
}
Wire up the UITextField to handle the appropriate editing event and in the event handler select the KeyboardType you want. If you don't need to dynamically set it then you can just set the property when you create the text field.
UITextField tf;
...
tf.KeyboardType = UIKeyboardType.PhonePad; // whatever kb you want

Focus and zoom in on a UITextField when touched?

How in the world does one get the iPhone view to zoom in on a focused UITextField? I need to tap on a text field that I want to edit, and my view should zoom in to the tapped text field and pull up the keyboard (which it already does), similar to how many Internet text fields gain focus on the iPhone. Is this some type of overlay?
I've been looking everywhere for this solution but maybe I've just got the wrong terminology. Thank you in advance.
Could be a duplicate of this StackOverflow question.
In essence, there are a number of ways, but you have to program this effect manually. A textfield is already an overlay. You can either move it, or scroll the containing view.
Please follow the following steps.
Implement the delegate method for all textfield.connect the outlet of textfield in interface builder basically it's setting the delegate property.then in delegate property you can defined the method whatever you want to implement or wanted to do functionality.
Thanks

Detect what's being inputed in a UITextField

I have a UITable View with a textfield that is editable right on the view (like Phone in contacts, etc.). I want to enable/disable my save button conditional up text being present in this field. So, I want the button to start out as disabled (for a new record) and then, as soon as I type the first letter into my text field, I want the button enabled. If I delete again back to zero, I would like the button disabled. You get the point.
Now, for doing this I need some way to detect the text being inputed while the user writes it (and when he finishes editing).
Does anybody know how to do this?
Thanks a lot. Still noob...
Try this: (from the Apple documentation for UITextInputTraits)
enablesReturnKeyAutomatically
A Boolean value indicating whether the return key is automatically enabled when text is entered by the user.
#property(nonatomic) BOOL enablesReturnKeyAutomatically
Discussion
The default value for this property is NO. If you set it to YES, the keyboard disables the return key when the text entry area contains no text. As soon as the user enters any text, the return key is automatically enabled.
Have your view controller adopt the UITextFieldDelegate protocol, and then implement a couple of the protocol's methods:
– textFieldDidBeginEditing:
– textFieldDidEndEditing:
Also, be sure to set the text field's delegate property to point to your view controller. The text field will then automatically send these messages to the controller when editing session begins and ends.