presentViewControllerで元の画面も見えるようにするのがうまくいかない

iPhoneのキーボードが表示されるように、自分の作ったViewControllerを表示させるやつです。

ViewControllerを作成し、そのViewControllerのViewのBackgroundをClearColorにしてpresentViewControllerすれば行ける…と思ったのですが、トランジション中は透けて見えるのに切り替わったとたんに画面が消えてしまいます。

https://developer.apple.com/jp/devcenter/ios/library/documentation/ViewControllerPGforiOS.pdf:title=iOS ViewController プログラミングガイド]を見ると、

View Controllerが表示される際、iOSは表示コンテキストを検索します。検索の最初の対象は、表示す る側のView Controllerで、そのdefinesPresentationContextプロパティを参照します。このプロパ ティ値がYESであれば、表示する側のView Controllerに表示コンテキストが定義されています。そうで なければ、View Controller階層を上に向かって順次たどり、YESを返すView Controllerが見つかるか、 ウインドウのルートView Controllerに到達するまで続けます。
あるView Controllerが表示コンテキストを定義する場合、これは表示スタイルも定義します。通常、 表示される側のView Controllerは、modalTransitionStyleプロパティで表示形態を判断します。 definesPresentationContextがYESであるView Controllerは、 providesPresentationContextTransitionStyleもYESとすることができます。 providesPresentationContextTransitionStyleがYESであれば、iOSは表示コンテキストの modalPresentationStyleを調べて、新しいView Controllerをどのように表示するか判断します。

となってるので、遷移元のViewControllerで

self.definesPresentationContext = YES;
self.providesPresentationContextTransitionStyle = YES;
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:vc animated:YES completion:nil];

とすればちゃんと透過してくれそう…なのですが。残念ながらこれはうまく行きませんでした。

色々はまったあげく、結局グーグル先生一押しの http://stackoverflow.com/questions/12736394/uimodalpresentationcurrentcontext-with-transition に答えが有りました。日本語の情報を優先して見てたのが敗因でした…

was able to accomplish this by setting modalPresentationStyle = UIModalPresentationCurrentContext on the rootViewController of my UIWindow, IF I haven't presented any new full screen viewControllers on top of this rootViewController. I did something like this:

UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:vc animated:YES completion:nil];

rootViewControllerが放してくれないようです。そいつのmodalPresentationStyleを変えてやってみたらうまいこと行きました。

ただ、この方法だとうまくトランジションがかからないようです。。。
うーむ、もう一息。

[もう少し調査が必要そうです。