hackiftekhar / IQKeyboardManager

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.
MIT License
16.47k stars 2.41k forks source link

Tint color ignored after addCancelDoneOnKeyboardWithTarget #1270

Closed tovkal closed 6 years ago

tovkal commented 6 years ago

Description

I have set the color for the toolbar:

IQKeyboardManager.sharedManager().toolbarTintColor = .white
IQKeyboardManager.sharedManager().toolbarBarTintColor = .red

This works fine. But then I want to add a cancel button, so I use

field.addCancelDoneOnKeyboardWithTarget(self, cancelAction: #selector(didTapCancelPicker), doneAction: #selector(didTapDoneOnPicker))

After that the toolbar colors reset to iOS's default grey and blue tint color.

Steps to Reproduce

  1. Set tint colors
  2. call addCancelDoneOnKeyboardWithTarget

Expected behavior: Tint colors remain set

Actual behavior: Tint colors are not applied, default white/blue appears.

Reproduces how often: 100%

Versions

Xcode: 9.2

Mac OS: 10.13

Simulator/Device: 11.2

Simulator/Device Name: iPhone 8 Plus

Library Version: 5.0.7

hackiftekhar commented 6 years ago

The color property will work only for those toolbar who are manage by IQKeyboardManager. If you are adding toolbar even via library method then you have to apply tintColor by your own. You can do so via accessing field.inputAccessoryView.tintColor = .red