overshare / overshare-kit

A soup-to-nuts sharing library for iOS.
MIT License
1.81k stars 132 forks source link

Custom tint color not used #14

Closed KrauseFx closed 10 years ago

KrauseFx commented 10 years ago

Maybe I'm missing something, but the tint color of the email dialog is not passed. Actual Result with OvershareKit: https://www.dropbox.com/s/wkfuxpgye9jjvri/Screenshot%202013-11-30%2018.26.39.png

Wanted Result: https://www.dropbox.com/s/tccor4scsaioxw7/Screenshot%202013-11-30%2018.26.49.png

The app itself has the correct tint color set: https://www.dropbox.com/s/umzvttlvsml2nh7/Screenshot%202013-11-30%2018.26.56.png

jaredsinclair commented 10 years ago

Can I see your code?

Sent from my iPhone

On Nov 30, 2013, at 12:27 PM, Felix Krause notifications@github.com wrote:

Maybe I'm missing something, but the tint color of the email dialog is not passed. Actual Result with OvershareKit: https://www.dropbox.com/s/wkfuxpgye9jjvri/Screenshot%202013-11-30%2018.26.39.png

Wanted Result: https://www.dropbox.com/s/tccor4scsaioxw7/Screenshot%202013-11-30%2018.26.49.png

The app itself has the correct tint color set: https://www.dropbox.com/s/umzvttlvsml2nh7/Screenshot%202013-11-30%2018.26.56.png

— Reply to this email directly or view it on GitHub.

KrauseFx commented 10 years ago

Setting the tint color

    UIColor *tintColor = [UIColor whiteColor];
    [[UIWindow appearance] setTintColor:tintColor];

    UIColor *barTintColor = [UIColor greenColor];

    [[UINavigationBar appearance] setBarTintColor:barTintColor];
    [[UINavigationBar appearance] setTitleTextAttributes:@{
                                                           NSForegroundColorAttributeName:[UIColor whiteColor]
                                                           }];

Calling OvershareKit

OSKShareableContent *shareSheet = [OSKShareableContent contentFromText:share];
[[OSKPresentationManager sharedInstance] presentActivitySheetForContent:shareSheet
                                                   presentingViewController:self.navigationController
                                                                    options:nil]

What's missing:

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
...
[mailController.navigationBar setTintColor:[UIWindow appearance].tintColor];
jaredsinclair commented 10 years ago

Checkout OSKPresentationViewControllers.h, one of the delegate protocol hooks into the OSKPresentationManager. Specifically, check out line 41:

`

If I understand the code you posted, you should be able to place the “what’s missing” code in there and tweak the appearance as needed.

Jared Sinclair Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Sunday, December 1, 2013 at 5:12 AM, Felix Krause wrote:

Setting the tint color UIColor tintColor = [UIColor whiteColor]; [[UIWindow appearance] setTintColor:tintColor]; UIColor barTintColor = [UIColor greenColor]; [[UINavigationBar appearance] setBarTintColor:barTintColor]; [[UINavigationBar appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor whiteColor] }];

Calling OvershareKit OSKShareableContent *shareSheet = [OSKShareableContent contentFromText:share]; [[OSKPresentationManager sharedInstance] presentActivitySheetForContent:shareSheet presentingViewController:self.navigationController options:nil]

What's missing: MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; ... [mailController.navigationBar setTintColor:[UIWindow appearance].tintColor];

— Reply to this email directly or view it on GitHub (https://github.com/overshare/overshare-kit/issues/14#issuecomment-29570867).

KrauseFx commented 10 years ago

Thanks, that's working. Still, this is an issue of the library: this should happen automatically for system view controllers.

This problem occurs every time you set a navigation bar background color and a font color, since only the navigation bar background color is applied to the mail composer sheet.

jaredsinclair commented 10 years ago

System view controllers (the Mail and Messages ones at least) should use their default navigation bar appearance. Otherwise, it may not be clear to users that they're using a remote instance of a built-in app.

This is why all non-system modal view controllers in OvershareKit use OSKNavigationController, an otherwise vanilla subclass of UINavigationController. That way you can apply custom appearance changes to that subclass without affecting system-provided navigation bars.

Sent from my iPhone

On Dec 2, 2013, at 5:38 AM, Felix Krause notifications@github.com wrote:

Thanks, that's working. Still, this is an issue of the library: this should happen automatically for system view controllers.

This problem occurs every time you set a navigation bar background color and a font color, since only the navigation bar background color is applied to the mail composer sheet.

— Reply to this email directly or view it on GitHub.