IQKeyboardManager icon indicating copy to clipboard operation
IQKeyboardManager copied to clipboard

Will you implement a dark mode?

Open JustinDMoore opened this issue 11 years ago • 18 comments

Will you support a dark mode to match the UIKeyboard dark mode? As it stands, your toolbar sticks out against the dark mode keyboard. Thanks

JustinDMoore avatar Feb 02 '15 07:02 JustinDMoore

@JustinDMoore this is already implemented i think. In my own app this is done automatically. there is code in IQKeyboardManager.m file inside the addToolbarIfRequired method. switch ([(UITextField*)textField keyboardAppearance]){ .... Do you have an example where this does not work as expected?

mythodeia avatar Feb 02 '15 07:02 mythodeia

I just began using IQKeyboardManager via pods today (latest version). All of my keyboards default to dark mode, but the toolbar is always light. There is no specific example other than it just isn't working for me. Is there a property I need to set that you're aware of? I didn't see one in the documentation. Thanks.

JustinDMoore avatar Feb 02 '15 07:02 JustinDMoore

Having looked at the method you mentioned, are you referring to _shouldToolbarUsesTextFieldTintColor?

JustinDMoore avatar Feb 02 '15 07:02 JustinDMoore

there is a

                    case UIKeyboardAppearanceAlert:
                    {
                        toolbar.barStyle = UIBarStyleBlack;

have you set the keyboardappearence to UIKeyboardAppearanceAlert?

mythodeia avatar Feb 02 '15 08:02 mythodeia

JustinDMoore avatar Feb 02 '15 08:02 JustinDMoore

the image below is from the demo project. demo

mythodeia avatar Feb 02 '15 08:02 mythodeia

In my AppDelegate, I set the following: [[IQKeyboardManager sharedManager] setShouldShowTextFieldPlaceholder:NO]; [[IQKeyboardManager sharedManager] setToolbarManageBehaviour:IQAutoToolbarByPosition]; [[IQKeyboardManager sharedManager] setKeyboardAppearance:UIKeyboardAppearanceAlert];

Is that not correct for the keyboard appearance?

JustinDMoore avatar Feb 02 '15 08:02 JustinDMoore

you should also set the overrideKeyboardAppearance like this before:

            [[IQKeyboardManager sharedManager] setOverrideKeyboardAppearance:YES];

mythodeia avatar Feb 02 '15 08:02 mythodeia

Modifying it to include overrideKeyboardAppearance didn't have any effect. Can't understand what is missing. [[IQKeyboardManager sharedManager] setOverrideKeyboardAppearance:YES]; [[IQKeyboardManager sharedManager] setShouldShowTextFieldPlaceholder:NO]; [[IQKeyboardManager sharedManager] setToolbarManageBehaviour:IQAutoToolbarByPosition]; [[IQKeyboardManager sharedManager] setKeyboardAppearance:UIKeyboardAppearanceAlert];

JustinDMoore avatar Feb 02 '15 08:02 JustinDMoore

can you try setting the KeyboardAppearance directly to a textfield and see if it works. if it does then maybe the OverrideKeyboardAppearance is not working as it should

mythodeia avatar Feb 02 '15 08:02 mythodeia

I've tried every combination I could think of.. changing UIKeyboardAppearanceAlert to UIKeyboardAppearanceDark.. with and without setOverrideKeyboardAppearance.. and setting the textfield directly. The keyboard itself will reflect light/dark mode accordingly, but the toolbar never changes.

JustinDMoore avatar Feb 02 '15 08:02 JustinDMoore

maybe @hackiftekhar can help here. I have exhausted all my ideas. I tried the following 2 lines in my project as well inside a uitableview full of textfields and all are working fine.

    [[IQKeyboardManager sharedManager] setOverrideKeyboardAppearance:YES];
    [[IQKeyboardManager sharedManager] setKeyboardAppearance:UIKeyboardAppearanceAlert];

maybe if you could setup a small demo project it would be easier to help debug this...

mythodeia avatar Feb 02 '15 08:02 mythodeia

@Justin, actually the pod is not updated yet. Current I'm going with a very busy schedule without having internet connectivity. I'll update the pod when got sometime to update it.

hackiftekhar avatar Feb 02 '15 16:02 hackiftekhar

@mythodeia , thanks for the help.

hackiftekhar avatar Feb 02 '15 16:02 hackiftekhar

:+1:

mythodeia avatar Feb 02 '15 16:02 mythodeia

Ok thanks. Good to know I'm not crazy!

JustinDMoore avatar Feb 02 '15 16:02 JustinDMoore

Release new cocoapods version 3.2.1.1. This contains the dark mode implementation. Thanks for your patience.

hackiftekhar avatar Feb 14 '15 11:02 hackiftekhar

Thanks so much. Updating soon.

JustinDMoore avatar Feb 14 '15 19:02 JustinDMoore