Appearance of SLComposeViewController Dark Keyboard

How to use UIKeyboardAppearanceDark with SLComposeViewController ?


The SLComposeViewController class provides the user with the ability to compose a message for supported social networks.

 SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; [self presentViewController:controller animated:YES completion:nil]; 

SLComposeViewController class reference


Nasty!

It looks like a light keyboard with a dark background: Ugly


Mockup!

It looks like a dark keyboard with a dark background: Mockup

+8
ios uikeyboard ios7 uiappearance
source share
4 answers

I tried several methods. The only way I found work was to configure the entire ComposeViewController . I also believe that this is the only possible way.

I found that an open source project calls REComposeViewController , and I configured it by default to UIKeyboardAppearanceDark . I uploaded to Github you can download and play with it.

Project : https://github.com/voyage11/SLComposeViewControllerWithBlackKeyboard

Attached Screenshot: -

enter image description here

+6
source share

After thoroughly understanding the problem you are facing and doing R&D, I suggest you switch to Custom ComposeViewController because you cannot change keyboardAppearance in ComposeViewController's .

To implement the Configure ComposeViewController follow these steps:

1) Made some kind of custom view, for example SLComposeViewController's View.

2) On the post button, you need to implement the logic in SLComposeViewControllerResultDone

  [_shareComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { switch (result) { case SLComposeViewControllerResultCancelled: break; case SLComposeViewControllerResultDone: { } break; default: break; } }]; 

3) . When you want to show your own view, make sure that the textView that you use in the custom view needs to set the keyboardAppearance's property to UIKeyboardAppearanceDark

  self.yourTextField.keyboardAppearance = UIKeyboardAppearanceDark; 

Below is an image to customize the view that was implemented in my recent project.

enter image description here

Hope this helps you.

+6
source share

This is a private class, so your only chance is to traverse the view hierarchy after SLComposeViewController loaded its view, finds the corresponding UITextField and sets keyboardAppearance to UIKeyboardAppearanceDark

Refreshing that even crossing the view hierarchy will be difficult (impossible) because it uses XPC and remote views.

+1
source share

You can use this code

 self.yourTextField.keyboardAppearance = UIKeyboardAppearanceDark; 
-2
source share

All Articles