UIApplicationクラス
アプリケーションクラス
解説
継承 | 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
シングルトンアプリケーションインスタンスを返します。
デフォルトのインターフェースの向きの管理
イベントハンドリングのコントロール
– sendEvent:
イベントを送信します。
– sendAction:to:from:forEvent:
– beginIgnoringInteractionEvents
– endIgnoringInteractionEvents
– isIgnoringInteractionEvents
applicationSupportsShakeToEdit property
proximitySensingEnabled property iOS3.0で使用中止
URLリソースのオープン
– openURL:
指定したURLを開きます。
– canOpenURL
与えられたURLリソースがアプリケーションで開くことができるかを返します。
リモート通知の登録
– registerForRemoteNotificationTypes:
– unregisterForRemoteNotifications
– enabledRemoteNotificationTypes
アプリケーションアクティビティの管理
idleTimerDisabled property
自動スリープするか
バックグラウンドでの動作の管理
applicationState property
backgroundTimeRemaining property
– beginBackgroundTaskWithExpirationHandler:
– endBackgroundTask:
– setKeepAliveTimeout:handler:
– clearKeepAliveTimeout
Performing State Restoration Asynchronously
ローカル通知の登録
– scheduleLocalNotification:
– presentLocalNotificationNow:
– cancelLocalNotification:
– cancelAllLocalNotifications
scheduledLocalNotifications property
Determining the Availability of Protected Content
protectedDataAvailable property
リモート・コントロールイベントの登録
– beginReceivingRemoteControlEvents
– endReceivingRemoteControlEvents
ステータスバー操作の管理
– setStatusBarOrientation:animated:
statusBarOrientation property
statusBarOrientationAnimationDuration property
アプリケーションアピアランスの管理
– 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
アプリケーションが終了しようとする通知