iOS 7 导航栏 SKStoreProductViewController [英] iOS 7 Nav Bar SKStoreProductViewController

查看:29
本文介绍了iOS 7 导航栏 SKStoreProductViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 6 中,引入了 SKStoreProductViewController 来显示应用程序中的 iTunes Store 项目,因此用户无需离开应用程序即可查看它们.

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.

到目前为止,我还没有找到自定义这个视图控制器的导航栏的方法.在 iOS 6 中,它是黑色带灰色书写,而在 iOS 7 中,它是白色带黑色书写.

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.

有什么办法可以改变导航栏的色调吗?(在 iOS 6 和 iOS 7 中)

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

谢谢.

推荐答案

不是最好的解决方案,但您可以使用 UINavigationBar 的 UIAppearance 方法在显示之前设置颜色:

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];

然后在 SKStoreProductViewControllerDelegate 方法中,将其改回之前的任何内容...

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];
}

对我有用.

这篇关于iOS 7 导航栏 SKStoreProductViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆