CLInputAccessoryView 介绍
CLInputAccessoryView 是点击输入框后,为弹出键盘添加上方的工具条。
使用方法:
#import "CLInputAccessoryView.h" // 初始化键盘上方工具栏 _inputAccessoryView = [[CLInputAccessoryView alloc] init]; [_inputAccessoryView addControlledTextView:_textField]; [_inputAccessoryView addControlledTextView:_textView]; _inputAccessoryView.leftButtonColor = [[UIColor grayColor] colorWithAlphaComponent:0.5]; // 如果点击按钮后只隐藏键盘,则不用添加委托,否则添加协议和委托 为使用类添加协议 <CLInputAccessoryViewDelegete> _inputAccessoryView.delegate = self; /** 点击左侧按钮后调用此方法,返回YES则隐藏键盘,NO则不隐藏键盘 */ - (BOOL)leftButtonDidClick:(id)textView { Nsstring *text = [textView text]; [textView setText:[text stringByAppendingString:@"取消 "]]; return YES; } /** 点击右侧按钮后触发此方法 */ - (BOOL)rightButtonDidClick:(id)textView { Nsstring *text = [textView text]; [textView setText:[text stringByAppendingString:@"完成 "]]; return NO; }
CLInputAccessoryView 官网
https://github.com/changelee82/CLInputAccessoryView
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。