首先,我们需要自定义一个textField 用于绑定语音搜索的功能。自定义键盘就没做了,只是简单的在键盘上方添加了一个inputAccessoryView。然后,我们需要自定义语音搜索的界面,界面如下

简单介绍一下,一个语音发送的按钮,一个文字提示的label ,还有一个动画的展示
首先我们定义touchView ,用于感知用户的 手指触摸范围,实现上滑的话,可以取消语音。




通过滑动touch的一些代理方法,我们可以拿到范围。语音搜索接入的是科大讯飞的语音的SDK,动画接入的lottie的。





这样我们的自定义的view就完成了

这样就结束了

一个简单的block就返回你搜索的词
网友评论