ios - 购买后更换背景图片

标签 ios objective-c in-app-purchase

我正在 ViewController 演示版本中设置背景图像。购买或使用应用内购买购买东西后,我想更改背景图像。

ViewController1.m 中的背景图像以及 ViewController2.m 中的应用内购买。

如何将值从ViewController2.m传递到ViewController1.m以更改背景图像。

最佳答案

使用 NSNotificationCenter。在ViewController1.m的viewDidLoad中添加观察者

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeBackground) name:kChangeBGNotification object:nil];

在 -(void)changeBackground 方法中进行更改

在 ViewController2.m 中发布通知

   [[NSNotificationCenter defaultCenter] postNotificationName:kChangeBGNotification object: managedObject];

关于ios - 购买后更换背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23286895/

相关文章:

ios - 首次使用后无后端应用程序崩溃

ios - 使用 AFNetworking 的 iOS 应用程序的 MVC 结构

ios - 可变数组合并数组到另一个数组

ios - 从 Cloud Code 解析 iOS 应用购买验证

ios - 检测 IAP "Thank You"消息

objective-c - 是否可以从 View Controller 请求 APNS 设备 token ?

objective-c - 禁用NSDictionary排序

ios - 根据进度计算线上的位置

ios - 使用 Xcode5.1 错误为 iOS 编译 libogg

android - 适用于非 Google Play 市场的优秀应用内购买 SDK