在iOS 6中,引入了SKStoreProductViewController来在应用程序中显示iTunes Store项目,因此用户不必离开应用程序即可查看它们。
到目前为止,我还没有找到一种自定义此视图控制器的导航栏的方法。在iOS 6中,它是黑色,带有灰色书写,在iOS 7中,它是白色,带有黑色书写。
有什么方法可以更改导航栏的颜色?(在iOS 6和iOS 7中)
谢谢。
不是最好的解决方案,但是可以在显示颜色之前使用UINavigationBar的UIAppearance方法设置颜色:
[[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
[storeProductViewController setDelegate:self];
[self presentViewController:storeProductViewController animated:YES completion:nil];
然后在SKStoreProductViewControllerDelegate方法中,将其更改回以前的版本。
-(void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[viewController dismissViewControllerAnimated:YES completion:nil];
}
为我工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句