Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with next/previous buttons with IQKeyboardManager

I am working in a Swift project where I have several input fields. I made a custom view for each of the input fields because we use them a lot in the project.

I added IQKeyboardManager to the project. It works really good, and the view gets up according to the active text field.

However, the Next/Previous buttons do not appear. I have tried setting the tags of the text fields in code like this:

slNameField.setTextField("Name", keyboardType: UIKeyboardType.NamePhonePad, image: UIImage(named: "ic_name"))
slNameField.txtField.tag = 101

slEmailField.setTextField("Email", keyboardType: UIKeyboardType.EmailAddress, image: UIImage(named: "ic_email"))
slEmailField.txtField.tag = 102

slLocationField.setTextField("City, Country", keyboardType: nil, image: UIImage(named: "ic_location"))
slLocationField.txtField.tag = 103

Here's some illustrations of the project:

The Signup Screen

like image 290
Ibrahim Yildirim Avatar asked Mar 11 '15 17:03

Ibrahim Yildirim


3 Answers

I am also stuck into same problem. As mentioned by @sam there is a very helpful demo project of the library.

Solution You only need to select the UIView in which all the textField or UIViews are. And then you just need to change it's class to

"IQPreviousNextView"

And all of the rest will be handled by the library.

Problem screen image

enter image description here

And solution is screen short

enter image description here

Hope it help :). it saved my day.

like image 85
Abdul Rehman Avatar answered Oct 21 '22 15:10

Abdul Rehman


@Ibrahim Yildirim, If next and previous buttons are not appearing on toolbar this is because textfields must not be in same uiview. they will only appear if all textfields are in same super view .

like image 7
Nitesh Avatar answered Oct 21 '22 16:10

Nitesh


Please add the line of code in your app delegate file (AppDelegate.swift) in this function: didFinishLaunchingWithOptions. The line of code: IQKeyboardManager.shared.previousNextDisplayMode = .alwaysShow

like image 2
HafizAnser Avatar answered Oct 21 '22 15:10

HafizAnser