0

私はAViewController.h以下のように持っています:

@interface AViewController : UIViewController

@end

@interface BViewController : AViewController;
- (void)MethodB;
@end

@interface CViewController : BViewController;

@end

それから私はAViewController.m以下のように持っています

@implementation AViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    NSLog(@"AViewController.viewWillAppear");
}

@end

@implementation BViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    NSLog(@"BViewController.viewWillAppear");
}
- (void)MethodB
{
    NSLog(@"show MehtodB");
}

@end

@implementation CViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated]; <--*** I want this line to call AViewController.viewWillAppear directly ***
    NSLog(@"CViewController.viewWillAppear");
    [self MethodB];
}

実行すると、次のようなログが取得されます。

2013-08-14 17:37:05.205 P1[12876:c07] AViewController.viewWillAppear
2013-08-14 17:37:05.206 P1[12876:c07] BViewController.viewWillAppear
2013-08-14 17:37:05.206 P1[12876:c07] CViewController.viewWillAppear
2013-08-14 17:37:05.207 P1[12876:c07] show MehtodB

しかし、必要なものは次のとおりです。

2013-08-14 17:37:05.205 P1[12876:c07] AViewController.viewWillAppear
2013-08-14 17:37:05.206 P1[12876:c07] CViewController.viewWillAppear
2013-08-14 17:37:05.207 P1[12876:c07] show MehtodB
4

1 に答える 1