iphone calculator keyboard
I am pretty new to iPhone development, so I don't know if this is even possible, but is it possible to customize a keyboard so it looks like a calculator? I know how to use inputAccessoryView
开发者_StackOverflow中文版 to put buttons on top of the keyboard, but I would like to put the add, multiply, divide and subtract buttons on the side to make it look like a more standard calculator. Is this possible?
Thanks.
The Buttons
Check out CodePadawan: iPhone Glossy Buttons for programmatically created calculator buttons.
However, I would suggest using PNG images for the button backgrounds. You can extract the normal button backgrounds (I didn't find selected button background.) from iPhone UI Vector Elements (linked to from iPhone and iPad Development GUI Kits, Stencils and Icons) with Adobe Illustrator by making a selection, copy, new, paste, Object > Artboards > Fit to Selected Art > Save for Web.
CalculatorMemoryButtonBackgroundNormal.png & CalculatorMemoryButtonBackgroundNormal@2x.png
CalculatorOperatorButtonBackgroundNormal.png & CalculatorOperatorButtonBackgroundNormal@2x.png
CalculatorDigitButtonBackgroundNormal.png & CalculatorDigitButtonBackgroundNormal@2x.png
CalculatorEqualButtonBackgroundNormal.png & CalculatorEqualButtonBackgroundNormal@2x.png
The Implementation
- How to create a custom keyboard
You will need a whole replacement "keyboard" with your own buttons and actions to do this. This will be a UIView holding a set of UIButtons. If you want this to pop up like the regular keyboard (as opposed to being on screen all the time like in the calculator app) then set your new view to be the inputView
of your text field rather than the inputAccessoryView
.
Since you are new to iPhone Application Development, I would say go to Youtube and watch tutorials on iPhone app dev, and it is of great resource. As for your "Calculator" project - visit this tutorial !
Not in any simple way. Given how simple this keyboard would be, this is better achieved by building a custom view.
Please see Custom iPhone Keyboard
However, it is possible that Apple could reject your app according to various SO posts on the issue.
精彩评论