1. Close the keyboard after textfield is input.
By adding an event for textfield, The did end on exit event is triggered when the done button is clicked when the input is complete.
In the event Method body, you only need one sentence:
1-(Action) textfileddoneediting :( ID) sender {2 [Sender resignfirstresponder]; 3}
Do not forget to add this event for textfield through IB.
The above is for textfield pop-up Input Keyboard has a button. What if the keyboard limits only the number key?
According to Apple's consistent style, the keyboard is canceled by clicking a blank space. Without a doubt, this user experience is quite good. How can this problem be solved?
Our views are all based on a view. The default view is inherited from the uiview. Because this uiview is too abstract, we need more specific things to add events, oh, so let's make the bottom view inherit from uicontrol.
Needless to say, uicontrol is a subclass of uiview. So we can use IB to add events to our underlying view, just like adding events to general components. At this time, it is (touch down). Don't make a mistake. Describes how to modify the inheritance relationship of a view.
You can select View in IB and press the combined key command + 4. The first line of view identity is the class option. If you select uicontrol, it will be OK. How to Write events.
1-(ibaction) backgroundtap :( ID) sender {2 [namefiled resignfirstresponder]; 3 [numberfield resignfirstresponder]; 4}
I only have two input boxes in the entire view.