loggerViewController.m で:
- (void)viewDidLoad
{
[super viewDidLoad];
UIView* mainView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.view addSubview:mainView]; // <-- Problem is here
}
loggingViewController は私の appDelegate の iVar です
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
.
.
loggingViewController = [[loggerViewController alloc] init];
[loggingViewController.view setBackgroundColor:[UIColor blueColor]];
// [loggingViewController loadView];
[self.view addSubview:loggingViewController.view];
}
私は AppDelegate が loggingViewController を呼び出すことを期待していました。これにより、内部に独自のサブビューが設定され、完了します。しかし、代わりに viewDidLoad が再帰的に呼び出される理由がわかりませんか?