マイスプリットビューコントローラコード:shouldAutorotateToInterfaceOrientationが複数回呼び出されています - これは正常ですか?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
LeftViewController *hvc = [[[LeftViewController alloc] initWithNibName:nil bundle:nil] autorelease];
DetailViewController *dvc = [[[DetailViewController alloc] initWithNibName:nil bundle:nil] autorelease];
UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:hvc] autorelease];
UINavigationController *detailNav = [[[UINavigationController alloc] initWithRootViewController:dvc] autorelease];
UISplitViewController *svc= [[[UISplitViewController alloc] init] autorelease];
[svc setViewControllers:[NSArray arrayWithObjects:rootNav, detailNav, nil]];
svc.delegate = dvc;
[window setRootViewController:svc];
[self.window makeKeyAndVisible];
return YES;
}
DetailViewController.mとLeftViewController.m両方がiPadのシミュレータで
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"should rotate asked to detailviewcontroller");
return YES;
}
が含まれているアプリはちょうど立ち上げますと、私はshouldAutorotateToInterfaceOrientation
にこれらの多くの呼び出しを見ることができます
should rotate asked to detailviewcontroller
should rotate asked to leftviewcontroller
should rotate asked to leftviewcontroller
should rotate asked to detailviewcontroller
...
should rotate asked to leftviewcontroller // these two lines
should rotate asked to detailviewcontroller // are repeated 13 times
...
should rotate asked to leftviewcontroller
should rotate asked to detailviewcontroller
この理由は何でしょうか。私は、シミュレータ
私は外部のエンティティが 'shouldAutorotateToInterfaceOrientation'を何度も呼び出すことができると理解します。しかし15回以上?トリガーは何ですか?ここで明らかに間違っていることがあれば、皆さんと二重にチェックしてみてください。 –