【问题标题】:how to add return key to Titanium searchbar for ios如何将返回键添加到 iOS 的 Titanium 搜索栏
【发布时间】:2017-11-21 15:32:57
【问题描述】:

我正在开发一个应用程序。我在搜索栏中遇到问题。当搜索栏没有文字时,它会禁用“搜索”键并且用户卡在屏幕上。

当用户开始在其中输入文本时,搜索键被启用。

我想在 Appcelerator Titan 搜索栏中添加 retu 键而不是搜索键,它应该用作返回键。按返回键应该隐藏键盘。

提前致谢。

【问题讨论】:

    标签: appcelerator appcelerator-titanium appcelerator-alloy appcelerator-studio


    【解决方案1】:

    您需要添加手动代码以在单击 SearchBar 的“取消”按钮时隐藏键盘。

    以下代码应按预期工作:

    <SearchBar id="search" showCancel="true" cancelButtonTitle="Hide" onCancel='hideKeyboard' />
    
    function hideKeyboard(e) {
        // it will hide the keyboard as well
        $.search.blur();
    }
    

    您可以使用其他事件来跟踪搜索栏是否为空,何时隐藏键盘或何时清除搜索文本等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-16
      • 2016-05-28
      • 1970-01-01
      • 2022-12-05
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多