macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

UIApplicationクラス

INDEX>UIKit>UIApplication

アプリケーションクラス

apple

解説

iPhone/iPadアプリケーションのクラスです。

継承 UIResponder : NSObject
準拠 NSObject (NSObject)
フレームワーク /System/Library/Frameworks/UIKit.framework
使用可能 iOS 2.0 以降
定義 UIApplication.h

概要

UIApplicationクラスは集中管理のポイントとiOSでのアプリケーションの実行調整を提供します。
すべてのアプリケーションはただ一つのUIApplication(またはそのサブクラス)のインスタンスを持たなければなりません。
アプリケーションが起動するとき、UIApplication関数が呼ばれます。

他のタスクの間で、この関数はシングルトンUIApplicationオブジェクトを作ります。
その後、+sharedApplicationクラスメソッドを起動してこのオブジェクトにアクセスすることができます。
UIAppicationオブジェクトの主な役割は、ユーザーイベントが到着したときイベントを振り分けます。

サブクラス化の注意

UIApplicationのサブクラスが -sendEvent: -sendAction:to:from:forEvent: の実装がカスタムイベントやアクションをオーバーライドするか決定しなければならない。

使用可能

iOS 2.0以降

メソッドとプロパティ

アプリケーションのインスタンスを得る

+ sharedApplication
 シングルトンアプリケーションインスタンスを返します。

アプリケーションのウインドウを得る

keyWindow property
 アプリケーションのキーウインドウ
windows property

デフォルトのインターフェースの向きの管理

– supportedInterfaceOrientationsForWindow:

URLリソースのオープン

– openURL:
 指定したURLを開きます。
– canOpenURL
 与えられたURLリソースがアプリケーションで開くことができるかを返します。

アプリケーションアクティビティの管理

idleTimerDisabled property
 自動スリープするか

Performing State Restoration Asynchronously

– extendStateRestoration
– completeStateRestoration

Determining the Availability of Protected Content

protectedDataAvailable property

リモート・コントロールイベントの登録

– beginReceivingRemoteControlEvents
– endReceivingRemoteControlEvents

アプリケーションアピアランスの管理

– setStatusBarHidden:animated:
statusBarHidden property
– setStatusBarStyle:animated:
statusBarStyle property
statusBarFrame property
networkActivityIndicatorVisible property
applicationIconBadgeNumber property
 スプリングボードでのアイコンバッチ番号

デリゲートのセットとゲット

delegate property

通知

UIApplicationDidBecomeActiveNotification
アプリケーションがアクティブになる通知
UIApplicationDidChangeStatusBarFrameNotification
ステータスバーのサイズが変更になった時に通知。向きが変わった時など

UIApplicationDidFinishLaunchingNotification
アプリケーションが起動しようとする通知

UIApplicationDidReceiveMemoryWarningNotification
メモリ不足の警告を通知

UIApplicationSignificantTimeChangeNotification
時間に変更があった場合の通知

UIApplicationWillChangeStatusBarOrientationNotification
デバイスの向きが変わろうとするときに通知

UIApplicationDidChangeStatusBarOrientationNotification
デバイスの向きが変わった後に通知

UIApplicationWillChangeStatusBarFrameNotification
ステータスバーのサイズが変更される直前に通知

UIApplicationWillResignActiveNotification
アプリケーションがアクティブでなくなろうとするときに通知

UIApplicationWillTerminateNotification
アプリケーションが終了しようとする通知