StoreKit's SKStoreProductViewController leavin

2019-05-23 02:12发布

问题:

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.