【问题标题】:Toolbar in Keyboard top with done Button and textfield Navigation键盘顶部的工具栏,带有完成按钮和文本字段导航
【发布时间】:2015-06-16 17:09:09
【问题描述】:

我在许多应用程序中都看到了这一点,但我在网上找不到有用的教程。 我如何在 Swift 中实现类似的功能?

【问题讨论】:

    标签: swift ios9


    【解决方案1】:

    好的,所以您需要在 NavigationBar 中添加 UITextField。这是应该可以帮助您的代码:

    var textField=UITextField()
    //Configure the size and other properties..
    self.navigationItem.titleView = textField
    

    对于右边的按钮,你应该这样做:

    var button = UIBarButtonItem(title: "FOO", style: UIBarButtonItemStyle.Plain, target: self, action: "FOO")
    self.navigationItem.rightBarButtonItem = button
    

    这一切都在那里完成,但我强烈认为您不应该在导航栏中添加登录表单,这是非常不切实际的。

    【讨论】:

    • 好吧,但我想在登录表单中使用它。
    • 谢谢。我会试试这个:-)
    猜你喜欢
    • 2012-01-10
    • 1970-01-01
    • 2014-03-05
    • 2018-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多