The property of the text input box named Valuetextfield on 1.xib is changed to the following scenario
2. Socket variables
@property (Weak, nonatomic) Iboutlet Uitextfield *valuetextfield;
3. Cancellation of First Responder
-(void) numberfieldcancle{ [Self.valuetextfield resignfirstresponder]; }
3. Generate toolbar
-(Uitoolbar *) addtoolbar{ *toolbar = [[Uitoolbar alloc] Initwithframe:cgrectmake (00 - )]; // uitoolbar *toolbar =[[uitoolbar alloc] init]; Uibarbuttonitem *bar = [[Uibarbuttonitem alloc] Initwithtitle:@ " done " style: Uibarbuttonitemstyleplain target:self Action: @selector (Numberfieldcancle)]; = @[bar]; return toolbar;}
4. Add a button to the keyboard when the keyboard is raised
-(BOOL) textfieldshouldbeginediting: (Uitextfield *) textfield{ if (textfield== Self.valuetextfield) { Self.valueTextField.inputAccessoryView=[self addtoolbar]; } return YES;}
5. Notice oh, this. m to comply with the uitextfielddelegate protocol
@interface Bnritemdetailviewcontroller () <UITextFieldDelegate>
iOS numeric keypad plus Finish button