内容の保証はできません。
/System/Library/frameWorks/UIKit.framework
クラス UIViewController †
NSObject
|
+--UIResponder
|
+--UIViewController
概要 †
iPhone OSで実行されるアプリケーションには、コンテンツを整理してユーザに表示するためのさま
ざまなオプションが用意されています。複数の画面におよぶ情報を持つアプリケーションは、それ
らの画面を表示するために複数のビューを提示します。舞台裏でこれらのビューを管理しているの
が、View Controllerオブジェクトです。
View Controllerオブジェクト(UIViewControllerクラスのインスタンス)は、一画面分のコンテンツを管理したり表示するための基本ロジックを提供します。View Controllerの基本クラスは、一連のビューをプログラムの中で作成したり、nibファイルからロードしたりするためのワークフローを提供しています。また、オペレーティングシステムと連携して、メモリ不足状態の間は、これらのビューをメモリから削除し、後で必要になったときに再構築する処理も行います。View Controllerは、ユーザがデバイスを回転したときにインターフェイスの向きを変更する動作や、現在のコンテンツの手前にほかのビューを一時的に表示する動作など、標準的なシステム動作のいくつかを自動的にサポートします。
UIViewController基本クラスのほかに、UIKitには、このプラットフォームに共通する複雑なイン
ターフェイス動作を処理する、より高度なサブクラスが含まれています。たとえば、ナビゲーショ
ンコントローラは、階層的な複数の画面におよぶコンテンツの表示を管理します。タブバーコント
ローラは、ユーザがアプリケーションの異なる操作モードを表す画面セット間を切り替えることを
可能にします。
インデックス †
NIBファイルを使用してコントローラを作成 †
- initWithNibName:bundle:
nibName property
nibBundle property
ビューの管理 †
view property
- loadView
- viewDidLoad
– viewDidUnload 3.0b以降
– isViewLoaded 3.0b以降
title (property) property
ビューイベントのレスポンス †
- viewWillAppear:
- viewDidAppear:
- viewWillDisappear:
- viewDidDisappear:
ビューレイアウトの動きを設定 †
wantsFullScreenLayout property 3.0b以降
ビューの回転設定の構成 †
interfaceOrientation property
- shouldAutorotateToInterfaceOrientation:
- rotatingHeaderView
- rotatingFooterView
ビュー回転イベントのレスポンス †
- willRotateToInterfaceOrientation:duration:
- willAnimateFirstHalfOfRotationToInterfaceOrientation:duration:
- didRotateFromInterfaceOrientation:
– willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: 3.0b以降
– didAnimateFirstHalfOfRotationToInterfaceOrientation: 3.0b以降
- willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration:
メモリ不足警告の処理 †
- didReceiveMemoryWarning
モーダルビューの管理 †
modalViewController property
parentViewController property
modalTransitionStyle property 3.0b以降
- presentModalViewController:animated:
- dismissModalViewControllerAnimated:
ナビゲーションアイテムの設計 †
navigationController property
navigationItem property
editing property
- setEditing:animated:
- editButtonItem
hidesBottomBarWhenPushed
ナビゲーションコントローラツールバーの構成 †
– setToolbarItems:animated: 3.0b以降
toolbarItems property 3.0b以降
タブバーアイテムの設計 †
tabBarController property
tabBarItem property
サーチディスプレイコントローラの取得 †
searchDisplayController property 3.0b以降
プロパティ †
editing †
ビューコンテンツが編集可能かどうかを返す。
@property(nonatomic, getter=isEditing) BOOL editing
hidesBottomBarWhenPushed †
ビューコントローラがナビゲーションコントローラをプッシュした時にスクリーン下部のバーを表示するかどうかを指定する。
@property(nonatomic) BOOL hidesBottomBarWhenPushed
interfaceOrientation †
インタフェースの現在の向きを返す。
@property(nonatomic, readonly) UIInterfaceOrientation interfaceOrientation
modalViewController †
レシーバによって管理されているビューのトップに一時的に表示されているモーダルビューのコントローラを返す。
@property(nonatomic, readonly) UIViewController *modalViewController
navigationController †
親のナビゲーションコントローラを返す。ないならnilを返す。
@property(nonatomic, readonly, retain) UINavigationController *navigationController
navigationItem †
ナビゲーションバーで表示を設定するためのアイテムを返す。
@property(nonatomic, readonly, retain) UINavigationItem *navigationItem
nibBundle †
レシーバのnibバンドルが存在するならその名前を返す。
@property(nonatomic, readonly, retain) NSBundle *nibBundle
nibName †
レシーバのnibファイルが存在するならその名前を返す。
@property(nonatomic, readonly, retain) NSString *nibName
parentViewController †
親のビューコントローラを返す。ないならnilを返す。
@propaerty(nonatomic, readonly) UIViewController *parentViewController
tabBarController †
親のタブバーコントローラを返す。ないならnilを返す。
@property(nonatomic, readonly, retain) UITabBarController *tabBarController
tabBarItem †
タブバーで表示を設定するためのアイテムを返す。
@property(nonatomic, retain) UITabBarItem *tabBarItem
title †
コントローラの管理するビューのタイトルを指定する。
@property(nonatomic, copy) NSString *title
view †
コントローラの管理するビューを指定する。
@property(nonatomic, retain) UIView *view
インスタンスメソッド †
didReceiveMemoryWarning †
アプリケーションがメモリ不足の警告を発した時この処理が呼ばれる。
- (void)didReceiveMemoryWarning
didRotateFromInterfaceOrientation: †
ユーザインタフェースが回転した後この処理が呼ばれる。
- (void)didRotateFromInterfaceOrientation:(UserInterfaceOrientation) fromInterfaceOrientation
dismissModalViewControllerAnimated: †
レシーバのモーダルビューコントローラを解放する。
- (void)dismissModalViewControllerAnimated:(BOOL) animated
editButtonItem †
トグルのタイトルや編集と完了の状態を連結させるボタンアイテムを返す。
- (UIBarButtonItem *)editButtonItem
initWithNibName:bundle: †
nibファイルとバンドルを指定してインスタンスを初期化する。
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
loadView †
コントローラの管理するビューを作成する。
- (void)loadView
presentModalViewController:animated: †
モーダルビューコントローラのプロパティを設定する。
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
rotatingFooterView †
ユーザインタフェースが回転する前と回転した後にフッタービューを返す。コントローラがタブバーコントローラならタブバーを返し、ナビゲーションバーコントローラならトップのビューコントローラを、キーボードがアクティブならキーボードを、それ以外ならnilを返す。
- (UIView *)rotatingFooterView
rotatingHeaderView †
ユーザインタフェースが回転する前と回転した後にヘッダビューを返す。コントローラがタブバーコントローラなら選択されたビューコントローラのヘッダビューを返し、ナビゲーションバーコントローラならナビゲーションバーを、それ以外ならnilを返す。
- (UIView *)rotatingHeaderView
setEditing:animated: †
編集可能なビューの表示方法を設定する。
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
shouldAutorotateToInterfaceOrientation: †
ビューの自動回転をサポートするかを指定する。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
viewDidAppear: †
ビューが最後まで描画された後やアニメーションが終了した後にこの処理が呼ばれる。
- (void)viewDidAppear:(BOOL)animated
viewDidDisappear: †
ビューが非表示にされたり解放された時にこの処理が呼ばれる。
- (void)viewDidDisappear:(BOOL)animated
viewDidLoad †
ビューの読み込みが終了した時にこの処理が呼ばれる。
- (void)viewDidLoad
viewWillAppear: †
ビューが描画される前やアニメーションが始まる前にこの処理が呼ばれる。
- (void)viewWillAppear:(BOOL)animated
viewWillDisappear: †
ビューが非表示にされる前や解放される前にこの処理が呼ばれる。
- (void)viewWillDisappear:(BOOL)animated
willAnimateFirstHalfOfRotationToInterfaceOrientation:duration: †
ユーザインタフェースの回転の最初の半分が始まる前にこの処理が呼ばれる。
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
willAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: †
ユーザインタフェースの回転の最後の半分が始まる前にこの処理が呼ばれる。
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration
willRotateToInterfaceOrientation:duration: †
ユーザインタフェースの回転を始める前にこの処理が呼ばれる。
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration: duration:(NSTimeInterval)duration