Dropboxのパスコード入力のようにModalViewにNavigationBarを付ける方法

DropboxiPhoneアプリは、起動時にパスコード入力するようにできる。その画面のように、ModalViewにNavigationBarを付ける方法はこんな感じです。

xxxViewController *myModalViewController = [[xxxViewController alloc] init];
UINavigationController *myNavigationController = [[UINavigationController alloc] initWithRootViewController:myModalViewController];

[self presentModalViewController:myModalViewController animated:YES];

[myModalViewController release];
[myNavigationController release];

まあ仕組みは簡単でpresentModalViewControllerメソッドは、引数としてUIViewControllerを渡すため、UIViewControllerを継承しているUINavigationControllerでもよいというわけです。