vendredi 28 novembre 2014

Changing iOS status bar color or navigation bar color after presenting a view controller?

So I'm using a third party api, specifically, this one: http://ift.tt/1xTYfG9


What this API does is basically let me make this call:



[[TwitchKit sharedPlugin] presentStreamForChannelNamed:channel.user mode:TKStreamPresentationModeRemainInApp];


where channel.user is a NSString with a Twitch channel name, and a new view pops over my current one with the video stream I am requesting.


I don't see any way to change Twitch's source, so I'm stuck with it how it is.


However, my app uses a dark color scheme, and Twitch's popover has what looks like a navigation bar at the top, but it's white (default Apple color). Since my color scheme is dark, my status bar is white. So when the Twitch overlay pops up, it makes the status bar unreasonable.


There's two simple solutions to this:



  • Make the status bar turn black when Twitch's view comes up.

  • Make Twitch's nav bar be dark.


Unfortunately, I can't seem to get either of these to work. I tried this right after the presentStreamForChannel call:



[self.presentedViewController.navigationController.navigationBar setBackgroundColor:[UIColor purpleColor]];


but no dice.


I also tried:



[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];


with little success.


How can I either make the status bar black when this transition happens, or make the new controller's bar dark?




Aucun commentaire:

Enregistrer un commentaire