0

i created a Subclass Inherit from UINavigationController, and all my Navigation Controllers Inherit from this class, when the app is running the viewDidLoad is called from my class, but the VIewWillAppear is not called any one have an idea ? im adding the subclass ViewWillAppear:

    //********************************************************************************************    
    //**  viewWillAppear                                                                                     
    //*********************************************************************************************

- (void) viewWillAppear:(BOOL)animated{
   [super viewWillAppear:animated];
   [self replacePng];
   self.title = @"";
}

this is the class:

//
//  MyViewController.m
//  Nifgashim
//
//  Created by shim wi on 7/15/14.
//  Copyright (c) 2014 Oded. All rights reserved.
//

#import "MyViewController.h"

@interface MyViewController ()

@end

@implementation MyViewController
@synthesize interstitial;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidLoad
{
[super viewDidLoad];
sing = [singData sharedInstance];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
    //********************************************************************************************     ******
 //**  viewWillAppear                                                                                   *
    //**************************************************************************************************
- (void) viewWillAppear:(BOOL)animated{
    if (sing.adInt == sing.adCount)
    {
        [self loadInterstitial];
    }
    else{
        sing.adCount++;
    }
    [super viewWillAppear:animated];

}

#pragma mark GADRequest implementation
//*********************************************************
//* GADRequest implementation                             *
//*********************************************************

- (GADRequest *)request {
    GADRequest *request = [GADRequest request];

    return request;
}
#pragma mark GADInterstitialDelegate implementation
//*********************************************************
//* interstitialDidReceiveAd                              *
//*********************************************************

- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
    [self.interstitial presentFromRootViewController:self];
}
#pragma mark didFailToReceiveAdWithError implementation
//*********************************************************
//* didFailToReceiveAdWithError                           *
//*********************************************************

- (void)interstitial:(GADInterstitial *)interstitial
didFailToReceiveAdWithError:(GADRequestError *)error {
}
//*********************************************************
//* loadInterstitial                                      *
//*********************************************************

-(void)loadInterstitial{
    self.interstitial = [[GADInterstitial alloc] init];
    self.interstitial.delegate = self;

   self.interstitial.adUnitID = MY_BANNER_UNIT_ID;
    [self.interstitial loadRequest:[self request]];
  }/*
    #pragma mark - Navigation

  // In a storyboard-based application, you will often want to do a little preparation     before navigation
  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
  // Get the new view controller using [segue destinationViewController].
  // Pass the selected object to the new view controller.
  }
  */

@end
Shimon Wiener
  • 1,004
  • 2
  • 17
  • 35
  • What do you have in `viewWillAppear` for your subclasses of `MyViewController` ? – Paulw11 Jul 16 '14 at 05:44
  • I added the function on top of the base class so you can see it – Shimon Wiener Jul 16 '14 at 06:36
  • Have you confirmed with breakpoints that neither subclass `viewWillAppear` is being called? – Paulw11 Jul 16 '14 at 06:41
  • the subclass ViewWillAppear is called but the base does not, the ViewDidLoad of the base class is called – Shimon Wiener Jul 16 '14 at 06:45
  • When you single step through `viewWillAppear` in the subclass what happens when it gets to `[super viewWillAppear]` ? Or perhaps I am confused. When you say subclass do you mean the `MyViewController` class or the final sub-class? Can you show your final subclass declaration – Paulw11 Jul 16 '14 at 06:48
  • I really don't know what i did but it start working, checking it out. – Shimon Wiener Jul 16 '14 at 08:10

0 Answers0