Cocoa API解説(macOS/iOS)

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。

目次

UIViewControllerクラス

INDEX>UIKit>

ビューをコントロールするクラスです。
継承 UIResponder : NSObject
準拠 NSCoding
NSObject (NSObject)
フレームワーク /System/Library/Frameworks/UIKit.framework
使用可能 iOS2.0
定義 UINavigationController.h

概要

ビューをコントロールするクラスです。画面遷移のコントロールも行います。
サブクラスを作ってビューの管理を行います。

Xcode5

Attribbutes Inspector:

⌘+option+4

Simulated Metrics

(ViewContloller)

Size:サイズ

Orientation:向き


Portrait:縦
Landscape:横

Status Bar:ステータスバー


None:なし
Default:デフォルト
Light Content:
Black:非推奨

Top Bar:
Bottom Bar:

ViewController

クラス

UIViewController

参照

タスク

Nibファイルからのビューコントローラーの作成

– initWithNibName:bundle
nibName property
nibBundle property

Storyboardの使用

– shouldPerformSegueWithIdentifier:sender
– performSegueWithIdentifier:sender
– prepareForSegue:sender
storyboard property
– canPerformUnwindSegueAction:fromViewController:withSender
– transitionCoordinator

ビューの管理

view property
– isViewLoaded
– loadView

– viewDidLoad

title property

– viewDidUnload 6.0で非推奨

– isViewLoaded 6.0で非推奨

メモリ警告の扱い

– didReceiveMemoryWarning

Testing for Specific Kinds of View Transitions

– isMovingFromParentViewController
– isMovingToParentViewController
– isBeingPresented
– isBeingDismissed

ビューのレイアウトの挙動の設定

– updateViewConstraints
automaticallyAdjustsScrollViewInsets property
bottomLayoutGuide property
topLayoutGuide property
edgesForExtendedLayout property
preferredContentSize property
extendedLayoutIncludesOpaqueBars property
– childViewControllerForStatusBarHidden
– childViewControllerForStatusBarStyle
– preferredStatusBarStyle
– prefersStatusBarHidden
modalPresentationCapturesStatusBarAppearance property
– preferredStatusBarUpdateAnimation
– setNeedsStatusBarAppearanceUpdate

wantsFullScreenLayout property [7.0で非推奨]

ビューの回転設定

– shouldAutorotate
– supportedInterfaceOrientations
– preferredInterfaceOrientationForPresentation
interfaceOrientation property

  1. attemptRotationToDeviceOrientation

– rotatingHeaderView
– rotatingFooterView

– shouldAutorotateToInterfaceOrientation Deprecated in iOS 6.0

Responding to Containment Events

– willMoveToParentViewController:
– didMoveToParentViewController:

Adding Editing Behaviors to Your View Controller

editing property
– setEditing:animated:

Managing State Restoration

restorationIdentifier property
restorationClass property
– encodeRestorableStateWithCoder:
– decodeRestorableStateWithCoder:
– applicationFinishedRestoringState

他のビューコントローラーを表示

– presentViewController:animated:completion:
– dismissViewControllerAnimated:completion:
modalTransitionStyle property
modalPresentationStyle property
definesPresentationContext property
transitioningDelegate property
providesPresentationContextTransitionStyle property
– disablesAutomaticKeyboardDismissal
– dismissModalViewControllerAnimated: Deprecated in iOS 6.0
– presentModalViewController:animated:
Deprecated in iOS 6.0

Getting Other Related View Controllers

presentingViewController property
presentedViewController property
parentViewController property
navigationController property
splitViewController property
tabBarController property
searchDisplayController property
modalViewController property Deprecated in iOS 6.0

Managing Child View Controllers in a Custom Container

childViewControllers property
– addChildViewController:
– removeFromParentViewController
– shouldAutomaticallyForwardRotationMethods
– shouldAutomaticallyForwardAppearanceMethods
– transitionFromViewController:toViewController:duration:options:animations:completion:
– beginAppearanceTransition:animated:
– endAppearanceTransition
– viewControllerForUnwindSegueAction:fromViewController:withSender:
– segueForUnwindingToViewController:fromViewController:identifier:
– automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers Deprecated in iOS 6.0

ナビゲーションアイテムを設定

navigationItem property

– editButtonItem

hidesBottomBarWhenPushed property

– setEditing:animated

toolbarItems property

タブバーアイテムを設定

tabBarItem property

Configuring Display in a Popover Controller

modalInPopover  property
contentSizeForViewInPopover  property Deprecated in iOS 7.0