Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 Nav Bar SKStoreProductViewController

In iOS 6, SKStoreProductViewController was introduced to show iTunes Store items in apps, so the user would not have to leave the app to view them.

So far, I have not found a way to customize the navigation bar of this view controller. In iOS 6, it is black with grey writing, and in iOS 7, it is white with black writing.

Is there any way to change the navigation bar's tint color? (In iOS 6 & iOS 7)

Thanks.

like image 773
Jake Chasan Avatar asked Sep 16 '13 23:09

Jake Chasan


Video Answer


1 Answers

Not the nicest solution but you can use UINavigationBar's UIAppearance method to set the colour just before you show it:

[[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];

SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
[storeProductViewController setDelegate:self];
[self presentViewController:storeProductViewController animated:YES completion:nil];

And then in the SKStoreProductViewControllerDelegate method, change it back to whatever it was previously...

-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    [viewController dismissViewControllerAnimated:YES completion:nil];
}

Works for me.

like image 95
Kiran Panesar Avatar answered Sep 23 '22 15:09

Kiran Panesar