4

のかなり奇妙な振る舞いを見つけましUINavigationBarUISplitViewController。下の写真に標準rootViewControllerがあります:

ここに画像の説明を入力してください

バーボタンが押されると(一時的に「追加ボタン」としてデバッグスタイルが設定されます)、画面上で行われたイベントを処理する新しいナビゲーションバーを追加します(注:追加します。置き換えません!)。

説明-ボタンが押され、ユーザーが画面上に描画を開始すると、描画モードを停止するための対話用の新しいバーが追加されます。

問題-しかし、このバーを追加すると、私のバーがrootViewController2つに分割されているところに奇妙なグラフィックの詳細が表示されます。下の写真(赤でマーク):

ここに画像の説明を入力してください

それは既知の問題ですか、それとも理由がありますか?

コード:

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];

注:私は代替の解決策を探していませんが、説明のためにこれが起こっている理由を探しています。

4

1 に答える 1

0

2番目のナビゲーションバーが最初のナビゲーションバーより少し低く追加されているため、青いバーに分割が表示されています。理由については、どのように追加するかについての詳細がなければ言えません。

于 2012-11-12T19:14:00.647 に答える