OC

Knowledge OS
主帖 8 条回复

SKStoreProductViewController的问题

jjjjjeffrey jjjjjeffrey · 2014年01月16日 · 阅读 5 · 无人欣赏。

查了很多资料,没有找到合适的解决方案,就是如何自定义这个viewController的NavigationBar?

征求解决方案,谢谢!

回复

8 条
#1
tinyfool
2014年01月16日

把这个vc放到一个new的NavigationViewController里,然后弹出,不可以么?

#2
jjjjjeffrey
2014年01月16日

1楼 @tinyfool To display a store, create a new SKStoreProductViewController object and set its delegate. Then, present the view controller modally from another view controller in your app. Your delegate dismisses the view controller when the user completes the purchase.

文档里是这么讲的。。。。

#5
jjjjjeffrey
2014年01月16日

3楼 @tinyfool

App的Navigationbar是这样的。

App的Navigationbar是这样的。

代码如下:

SKStoreProductViewController *productVC = [[SKStoreProductViewController alloc] init]; productVC.delegate = self; NSDictionary *parameters = @{SKStoreProductParameterITunesItemIdentifier: @"333206289"}; [productVC loadProductWithParameters:parameters completionBlock:^(BOOL result, NSError *error){ if (result) { [self hideHud:YES afterDelay:0]; DQNavigationController *nav = [[DQNavigationController alloc] initWithRootViewController:productVC]; [self presentViewController:nav animated:YES completion:^{}]; } else { //跳转appstore做法 NSString *string = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/us/app/id%@?mt=8", @"333206289"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]]; } }];

present后的效果:

present后的效果:

#7
jjjjjeffrey
2014年01月16日

为毛这个viewController不能像UIImagePickerController设计的一样,方便自定义。。。

#8
adad184
2014年01月16日

如果你会用

 [[UINavigationBar appearance]

那么再找找

[[UINavigationBar appearanceWhenContainedIn:[XXNavController class], nil]

的用法

那么你这个问题就解决了 锻炼一下找答案的能力

另外 UIImagePickerController是一个UINavigationController 不是UIViewController

登录 或者 注册