Luke Pistrol
Luke Pistrol

Reputation: 1209

Toolbar in Keyboard top with done Button and textfield Navigation

I've seen that in many apps but I can't find an useful tutorial online. How can I realize something like that in Swift?

enter image description here

Upvotes: 0

Views: 740

Answers (1)

Dhruv Ramani
Dhruv Ramani

Reputation: 2643

Okay, So you need to add a UITextField to your NavigationBar. Here's the code that should help you :

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

And for the button on the right, you should do this :

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

That's all done there, but I strongly think that you shouldn't add a login form to your navigation bar, it's very impractical.

Upvotes: 1

Related Questions