Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewController.h"
- #import "Intro.h"
- #import "PurchasedViewController.h"
- #import <iAd/iAd.h>
- #import "InAppManager.h"
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(reload)
- name:@"reloadIntro"
- object:nil];
- // Configure the view.
- SKView * skView = (SKView *)self.view;
- // Create and configure the scene.
- SKScene *scene = [Intro sceneWithSize:skView.bounds.size];
- scene.scaleMode = SKSceneScaleModeAspectFill;
- // Present the scene
- [skView presentScene:scene];
- }
- -(void)reload {
- // Reload the View/Scene to remove iAds
- .....
- }
- - (void)viewDidAppear:(BOOL)animated {
- [super viewDidAppear:animated];
- //Display iAds
- if ( [[InAppManager sharedManager] isFeature1PurchasedAlready] == FALSE) {
- NSLog(@"iAds are showing");
- ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 480, 320, 50)];
- [self.view addSubview:adView];
- }
- //Remove iAds
- else if ( [[InAppManager sharedManager] isFeature1PurchasedAlready] == TRUE) {
- NSLog(@"iAds have been removed");
- ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 480, 320, 50)];
- adView.hidden = YES;
- [adView removeFromSuperview];
- }
- }
- -(void) unlockProduct1 {
- if ( [[InAppManager sharedManager] isFeature1PurchasedAlready] == NO) {
- NSLog(@"Product 1 was not bought yet");
- [buyProduct1Button setBackgroundImage:[UIImage imageNamed:@"Remove_Ads"] forState:UIControlStateNormal];
- }
- else {
- NSLog(@"Product 1 WAS bought");
- [buyProduct1Button setBackgroundImage:[UIImage imageNamed:@"Purchased"] forState:UIControlStateNormal];
- // Sending Notification to ViewController.m
- NSLog(@"Did Send notification reloadIntro");
- [[NSNotificationCenter defaultCenter] postNotificationName:@"reloadIntro" object:nil];
- }
- }
- - (IBAction)dismissPurchasedVC:(UIButton *)sender {
- [self dismissModalViewControllerAnimated:YES];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement