views:

374

answers:

1

I have a table view with each cell having a text field accepting numeric values only. I added the custom decimal place to the default numeric keypad, for my purpose. Since there is no "Done" button to dispose the keypad, I added a button over the table view. The button's background's opaque value is set to zero. The button is hidden when there is no keypad. When a user clicks on the text field, I un-hide the button. On clicking on the background, the keypad is disposed and the button is hidden again. This is working. My questions are: 1. Is this acceptable solution for dismissing the keypad? It does not seem to be the best way of doing it. 2. With this solution I have one problem: If a user enters in one text field and then clicks inside another visible text field without clicking on the background elsewhere, what happens is the keypad is dismissed since the event is caught by the invisible button. The user should be able to continue editing inside the other text field. Instead now the user has to once again click inside the other text field and start entering the values.

Any one has better suggestions? Thanks.

+1  A: 

Yes in numeric keypad there is not done/return button. But if you are using table then u can set tag to all textfields and set the frame of table accorading with selected textfield to display in center. and another possible way to dismiss keypad is you can set resign call to table scrollview delegate method. - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; so when user scroll the table, keypad will dismissed.

Jay Vachhani