Life is Really Short, Have Your Life!!

ござ先輩の主に技術的なメモ

setToolBarItemsを使用せずツールバーを追加する

UIViewControllerにはsetToolBaritems:というメソッドが用意されている。iOS3.0以降で。これを使えばツールバーが使えるように見えるが、そうでないこともある。

本家のリファレンスより。

Discussion

View controllers that are managed by a navigation controller can use this method to specify toolbar items for the navigation controller’s built-in toolbar. You can set the toolbar items for your view controller before your view controller is displayed or after it is already visible.

iOS Developer Library

UINavigationControllerの管理下にあるViewControllerは、UINavigationController組み込まれているツールバーの要素を特定する為にこのメソッドを使う事が出来ます。ViewContollerが表示される前でもあとでも、大丈夫です。

だってお。

NavigationController管理下に無い場合は、このページのリンクのコードにあるようにUIToolbarをalloc→initして使う。ラベルを貼付けるのと同じような感じですね。

no title