StoreKit's SKStoreProductViewController leaving space between the nav bar and the view?

风格不统一 提交于 2019-12-10 10:34:42

问题


I have this subclass of UIViewController that shows a SKStoreProductViewController. This view controller was originally created for iOS 5 and is NOT using auto-layout. My problem is that when the SKStoreProductViewController is presented, there's a space between the nav bar and the actual content... if you scroll the view, the segmented control (Details/Reviews/Related) floats below the nav bar (see the images below, I added a mask to the images to make the problem more apparent).

Since we don't have access to the presented view controller I'm guessing it has to do with the controller that presents the SKStoreProductViewController. When the user taps on the button that presents the controller I've tried to change/shift the frame of the view, I've also done something like self.navigationController.navigationBar.translucent = NO; but nothing seems to help.

Has anyone have had a similar problem? Any ideas on how to fix it?


回答1:


It seems like there's a bug on the UIAppearance protocol on iOS 7. I found people having (other) problems when using UIAppearance. I was using something like:

[[UINavigationBar appearance] setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

which works on iOS 5, but for iOS 6+ I set the background image directly on the navigation bar:

[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

It looks like a small difference, but it fixed my problem.



来源:https://stackoverflow.com/questions/22617937/storekits-skstoreproductviewcontroller-leaving-space-between-the-nav-bar-and-th

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!