- (void)createKeyboardTool
{
    keyboardTool = [[UIToolbar alloc] initWithFrame: CGRectMake(kZero, kZero, kScreenW, 44.0f)];
    NSMutableArray *myToolBarItems = [NSMutableArray array];

  //创建键盘工具条上面的按钮,并设置点击事件 UIBarButtonItem
*cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(cancelAction)]; UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:@selector(saveAction)]; UIBarButtonItem *saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(saveAction)]; [myToolBarItems addObject:cancelBtn]; [myToolBarItems addObject:space]; [myToolBarItems addObject:saveBtn]; keyboardTool.items = myToolBarItems; }
    //inputAccessoryView:设置键盘顶部显示的工具条;inputView:自定义键盘
commentTextView = [[UITextView alloc]initWithFrame:CGRectMake(kZero, kZero, kScreenW, 200)]; [commentTextView becomeFirstResponder]; commentTextView.inputAccessoryView = keyboardTool;

 

相关文章:

  • 2021-09-28
  • 2021-12-05
  • 2021-12-14
  • 2022-02-25
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-01
  • 2021-10-26
  • 2022-12-23
  • 2021-05-17
  • 2021-05-31
  • 2022-02-26
相关资源
相似解决方案