Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SLComposeViewController Dark Keyboard Appearance

How to use UIKeyboardAppearanceDark with SLComposeViewController?


The SLComposeViewController class presents a view to the user to compose a post for supported social networking services.

SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];

[self presentViewController:controller
                   animated:YES
                 completion:nil];

SLComposeViewController Class Reference


Ugly!

This is how the light keyboard looks with a dark background:Ugly


Mockup!

This is how the dark keyboard looks with a dark background:Mockup

like image 408
Zelko Avatar asked May 12 '14 04:05

Zelko


2 Answers

I have tried a few methods. The only way that I found working is to customize the entire ComposeViewController. I also believe it is the only possible way.

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

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

Attached Screen shot:-

enter image description here

like image 73
Ricky Avatar answered Oct 14 '22 06:10

Ricky


After carefully understanding the problem you are facing and doing some R&D, I'm suggest you to go for Custom ComposeViewController, because you can't change the keyboardAppearance of ComposeViewController's keyboard.

For implementing Customize ComposeViewController follow the below steps:

1) Made some custom view like 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) And when you wants to show your custom view, make sure that the textView you are using in the custom view must be assign keyboardAppearance's property to UIKeyboardAppearanceDark

 self.yourTextField.keyboardAppearance = UIKeyboardAppearanceDark;

Below is the picture of customize view, that I implemented in a my recent project.

enter image description here

Hopefully it will helps you.

like image 43
Irfan Avatar answered Oct 14 '22 05:10

Irfan