Custom Number Pad UIKeyboard - iphone

How would I go about creating a custom number pad like what is used in 'Tipulator' and other apps.
I know how you can customize UIKeyboard, but their number pad doesn't look at all like the default number pad. Is it even a UIKeyboard or a separate UIView?

I've been working with keyboards for quite a time. I would say that the easiness of this depends on what your target text input view is. If is a UITextView then we are fine, if is UITextField you might have some problems because you don't have access to current cursor text position like un UITextView.
(You might check UITextView and UITextViewDelegate methods)
If you just want to set a string and don't mind current cursor text position, then you don't need a keyboard. (I think this is the case of Tipulator)
BTW: I just saw Tipulator in youtube and there is no necessity of a keyboard for doing that.

Judging by the looks: It's a custom UIView subclass. Basically, it's just a panel with 11 buttons on it, so it should be rather easy to do.

Related

Issue using UITextField with long string

So currntly I have multiple UITextFields whose data is automatically inputted for the user when the app launches, mainly gets the location of the user and inputs them into the textfields.
Now, the issue is, when the textfields are filled, the textfields expand in width with respect to how much text is in the body of the UITextFields.
Heres a few pics of what really is going on, I'm also using nib files to create the layout, the left pic is of the application not getting an address inputted into the UITextfield from CLGeocoder coordinates, whereas the right view shows the UITextfield getting address string from the CLGeocoder.
I also notice that when I finish typing in a field, the fields EXPAND after I press return and the keyboard is dismissed.
I'm sure there is probably a setting in the nib file I uncheck or maybe I have to do this programatically? By instantiating the UITextfields programatically i mean.
As Rocky has already said, the problem is with auto-layout option of iOS 6.0. I also ran into this painful thing a while back. Turn off Auto-layout but now you will have to maintain two storyboards, one for iPhone 5 and there other for iPhone 4 and lower. Fun isn't it?
If you still decide to use auto-layout, make sure there are no User Constraints on the UITextFields where the Width is set to "Greater Than or Equal". This will allow the control to expand based on the content. If there are, just delete them.

iPhone keyboard with a UITextView

I feel that this question has been asked 10^78 times, but for some reason, am unable to find the question, nor the answer ..
I want to add a keyboard with a uitextView at the top .. Exactly like the default SMS application on the iPhone ..
How can I do that?
*Bonus: if you can also give me a hint as to how to animate it with the keyboard (goes down when the keyboard animates out .. and goes up with the keyboard);
You need to use a UIToolbar (containing your text views, etc.) and set the inputAccessoryView property of the UITextView to that toolbar. The animation should take place without any additional code.
See http://www.randomsequence.com/articles/adding-a-toolbar-with-next-previous-above-uitextfield-keyboard-iphone/

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

iPhone SDK: How to create a UITextView that inserts text where you tap?

I'd like to create a UITextView that you can tap anywhere within it and start typing at that location. The default behavior of the control is that typing starts where the last character ended. So, if I had a UITextView with no text in it and tap in the middle of the control, I'd like typing to start there--not in the upper left.
What is the best way to implement this behavior? I've considered making the default text value of the view to be 3000 space characters or something similar, but this seems like not an elegant solution. Suggestions?
I suggest deriving from UITextView to create a custom view that handles taps. You'll want to override the following methods, probably:
touchesBegan:withEvent
touchesMoved:withEvent
touchesEnded:withEvent
touchesCancelled:withEvent
Make sure the userInteractionEnabled property has a default value of YES. Override hitTest:withEvent and pointInside:withEvent to figure out where in your view the user tapped.
Be sure and read the Responding to Events section in the View Programming Guide for iOS, and also see the Event Handling Guide for iOS for more details.
Anyway, once you figure out where the user touched, you can modify the text or reposition the karat as appropriate.

Custom UIView with keyboard input?

I have a custom UILabel subclass for displaying currency values. I only want the user to be able to enter digits and let the view format those digits into a currency value -- like a cash register. This makes UITextField an inappropriate choice for this kind of input.
I've already overridden hitTest: so that the UILabel will return itself -- this is apparently a bug. Also, I've overridden both canBecomeFirstResponder and becomeFirstResponder to return YES. Neither of these methods are being called, though.
I only want to let the user type numbers and use the backspace key. I've implemented UITextInputTraits, but the keyboard does not appear. So, can this be done? And does if so, what am I missing?
I've done something like this. Subclass UITextField, make its text color clear, and stick a label on top of it to display the formatted version.
edit - actually, strictly speaking you shouldn't even need to subclass it. Just implement the delegate method (-textField:shouldChangeCharactersInRange:replacementString:), add the label to the UITextField, and format the label's text however you need to.
OK, I've answered my own question: a UILabel placed on top of the UITextView will also hide the insertion point, but can still become the first responder and get input.
Thanks!