首页 > 代码库 > 给键盘添加工具栏(按钮)

给键盘添加工具栏(按钮)

<style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ffffff } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #00b1ff } span.s1 { } span.s2 { color: #00b1ff } span.s3 { color: #ffffff } span.s4 { color: #ff4647 } span.s5 { color: #de38a5 } span.s6 { color: #08fa95 }</style> <style>p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #ffffff } p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Menlo; color: #00b1ff } span.s1 { } span.s2 { color: #00b1ff } span.s3 { color: #ffffff } span.s4 { color: #ff4647 } span.s5 { color: #de38a5 } span.s6 { color: #08fa95 }</style>

 UIToolbar *keyboardDoneButtonView = [[UIToolbar alloc] init];

    [keyboardDoneButtonView sizeToFit];

    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done"

                                                                   style:UIBarButtonItemStylePlain target:self

                                                                  action:@selector(doneClicked:)];

    [keyboardDoneButtonView setItems:[NSArray arrayWithObjects:doneButton, nil]];

    self.textField.inputAccessoryView = keyboardDoneButtonView;

 

给键盘添加工具栏(按钮)