码迷,mamicode.com
首页 > 其他好文 > 详细

设置键盘顶部显示的工具条

时间:2014-08-04 13:28:57      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   cti   ar   div   log   

- (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;

 

设置键盘顶部显示的工具条,布布扣,bubuko.com

设置键盘顶部显示的工具条

标签:style   blog   color   io   cti   ar   div   log   

原文地址:http://www.cnblogs.com/hw140430/p/3889557.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!