1

I'm using the TapJoy SDK for a game application on iOS. The SDK has a way to display a view on top of the application: http://knowledge.tapjoy.com/integration-8-x/ios/pb/featured-app

I can give the function a UIVIewController argument, so I can manage the show/hide by myself.

I have created the following UIViewVontroller:

@interface MyViewController : UIViewController

- (void) viewDidLoad;
- (void) viewDidUnload;
- (void) viewWillLoad;
- (void) viewWillUnload;

- (void)viewWillAppear:(BOOL)animated;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewWillDisappear:(BOOL)animated;
- (void)viewDidDisappear:(BOOL)animated;

@end

@implementation MyViewController

- (void) viewDidLoad
{
    self.view = GRAPHIC_SYSTEM::GetGlView();

    NSLog(@"viewDidLoad");
}

- (void) viewDidUnload
{
    NSLog(@"viewDidUnload");
}

- (void) viewWillLoad
{
    NSLog(@"viewWillLoad");
}

- (void) viewWillUnload
{
    NSLog(@"viewWillUnload");
}

- (void)viewWillAppear: (bool)animated
{
    NSLog(@"viewWillAppear");
}

- (void)viewDidAppear:(BOOL)animated
{
NSLog(@"viewDidAppear");    
}

- (void)viewWillDisappear:(BOOL)animated
{
    NSLog(@"viewWillDisappear");
}

- (void)viewDidDisappear:(BOOL)animated
{
    NSLog(@"viewDidDisappear");
}

@end

When I'm notified by TapJoy that a feature app is available, I show it using my view controller:

[TapjoyConnect showFeaturedAppFullScreenAdWithViewController: [[MyViewController alloc] init]];

The TapJoy view is successfully displayed on top of my game.

There are 2 problems:

  1. Only the viewDidLoad log is printed in the console. None of the other log messages are printed
  2. I would like to know when the user has closed the TapJoy view, so I can add some processing at that time, but none of the other functions of the view controller are called.

I've seen here on SO that some users recommend to use the Notifications. Unfortunately, as I don't have access to the source code of the TapJoy SDK, I need to find another way.

Do you have any ideas?

Thanks in advance

Mike

1 Answer 1

0

Well I could fix the issue by creating a custom UIView, which I set as the UIViewController view.

Next, I have then overriden the willRemoveSubview function of this custom view.

And with the viewDidLoad function of the UIViewController, I know when the view is displayed, AND when the TapJoy view is removed, so I can remove my custom view too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.