0

I am writing a MonoTouch iOS app. I have read many postings about ResignFirstResponder and I am using that.

My app is a typical table view app. I have done my own custom table cell view. The UITextField controls that cause the numeric keypad to come up in the first place are all on the custom table cell.

Currently I have it so that if you tap on the background of the cell I call ResignFirstResponder on all the text fields. This seems to work, but is not intuitive. I had a new beta tester get it last night and he tapped on one of the text fields and the keypad came up and he was lost as to how to get rid of it. After I told him to just tap the background, he now is fine, but obviously I want a solution that is obvious and doesn't require me to tell everyone how it works.

I read one post about a way to add a DONE button to the keypad, but it looked like a total hack and even broke when 3.2.1 came out and I don't want to have to worry about my app breaking when a new OS comes out.

Suggestions?

4

1 回答 1

1

我会保留您已经拥有的背景单击-> ResignFirstResponder,但添加到它。

好奇,你在键盘右下角设置了什么按钮?有一些选项可以显示完成、搜索、开始、下一步等按钮,这些按钮可以设置为 ResignFirstResponder。选择对您的情况有意义的按钮。

您可以通过设置回调到 UITextField.ShouldReturn 并调用 ResignFirstResponder 来连接到右下角的按钮。您可以只返回 false (该返回值用于允许 UITextField 中的换行符)。

在这里找到了一个连接 ShouldReturn 的示例。

于 2012-01-09T13:32:56.773 回答