在键盘上方添加TextFiled和按钮,只有自定义View,然后随键盘的弹出消失而改变吗?
为了答好楼主的题目我自己写了个测试,请看效果图

实现原理在这里, command + shit + O 输入 UITextField.h 在第94行
我这里用了UILabel
,理论上只要是UIView类都可以
self.nameField.inputAccessoryView = _dingdingLabel;
objc
// Presented when object becomes first responder. If set to nil, reverts to following responder chain. If // set while first responder, will not take effect until reloadInputViews is called. @property (readwrite, retain) UIView *inputView; @property (readwrite, retain) UIView *inputAccessoryView;
你想表达什么,不知所云
之前需要这种类似的东西,我采用的办法就是定义一个view加上textfield和button。
然后根据键盘事件来判断这个view的出现和上移,但是我觉得这种不是那么合理。
提供一个思路希望对你有帮助。
在键盘上是可以添加一个控件叫uitoolbar的,我以前写过在uitoolbar上添加按钮,我刚刚查了一些uitoolbar也是可以添加自定义view的。可以尝试一下uitoolbar。