のかなり奇妙な振る舞いを見つけましUINavigationBar
たUISplitViewController
。下の写真に標準rootViewController
があります:
バーボタンが押されると(一時的に「追加ボタン」としてデバッグスタイルが設定されます)、画面上で行われたイベントを処理する新しいナビゲーションバーを追加します(注:追加します。置き換えません!)。
説明-ボタンが押され、ユーザーが画面上に描画を開始すると、描画モードを停止するための対話用の新しいバーが追加されます。
問題-しかし、このバーを追加すると、私のバーがrootViewController
2つに分割されているところに奇妙なグラフィックの詳細が表示されます。下の写真(赤でマーク):
それは既知の問題ですか、それとも理由がありますか?
コード:
UINavigationBar *tmpBar = [[UINavigationBar alloc] initWithFrame:CGRectOffset(CGRectMake(0.0, 0.0, 1024.0, 44.0), 0, - 44.0)];
UINavigationItem *it = [[UINavigationItem alloc] initWithTitle:@"Draw, baby, draw!"];
it.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelDrawing)];
it.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(sendMail)];
tmpBar.items = [[NSArray alloc] initWithObjects:it, nil];
self.canvasBar = tmpBar;
[self.splitViewController.view addSubview:self.canvasBar];
[self.splitViewController.view bringSubviewToFront:self.canvasBar];
[UIView beginAnimations:@"animateBarOn" context:NULL];
[UIView setAnimationDuration:1.0];
[self.canvasBar setFrame:CGRectOffset([self.canvasBar frame], 0, 44)];
[UIView commitAnimations];
注:私は代替の解決策を探していませんが、説明のためにこれが起こっている理由を探しています。