UIPopoverControllerをiPhoneで使う
3.2でiPad用に新設されたこのUI、iOS4だと使えたりしないのかな、と思い試してみました。
iPadではちゃんと動作するところまで作って、iPhoneシミュレータで動作させようとすると
-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.
ってエラーが出ました。やはりダメみたいです。
WEPopover
でもこんなのを見つけました。
Before I implement something similar for the iPhone, I'm wondering if anyone has implemented something similar of the UIPopOverController for the iPhone. This is so far only available for iPad.
(意訳:誰かもうUIPopOverControllerみたいなの作ってたりします?)
See my implementation here: https://github.com/werner77/WEPopover
It has the same interface as the UIPopoverController but is generalized for iPhone and with support for custom background views.
(意訳:私が作ったのがあります。UIPopOverControllerと同じinterfaceを持ってて、違う点はiPhone用に生成する点と、背景ビューのカスタムが可能な点です)
すばらしすぎる!さっそくgithubからダウンロードしてビルド。
こんな感じでポップオーバーが表示されました。
ちゃんと場所に応じてフキダシの先端方向も変わるし、実によくできてます。