您的位置:首页 > 移动开发

【UIKit】-12-UIApplication - appDelegate 中

2015-07-22 16:23 337 查看
参考
http://blog.csdn.net/huifeidexin_1/article/details/7792371 http://www.cnblogs.com/wendingding/p/3766347.html http://sdlqhjk.iteye.com/blog/1743848
暂无实例,以后修改

The UIApplication class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication (or a subclass of UIApplication). When an app
is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access this object by invoking the sharedApplication class method. A major role of a UIApplication object is
to handle the initial routing of incoming user events. It also dispatches action messages forwarded to it by control objects (UIControl) to the appropriate target objects. In addition, the UIApplication object maintains a list of all the windows (UIWindow
objects) currently open in the app, so through those it can retrieve any of the app’s UIView objects. The app object is typically assigned a delegate, an object that the app informs of significant runtime events—for example, app launch, low-memory warnings,
and app termination—giving it an opportunity to respond appropriately. Apps can cooperatively handle a resource such as an email or an image file through the openURL: method. For example, an app opening an email URL with this method may cause the mail client
to launch and display the message.

UiApplication类提供控制和iOS上运行的应用程序协调的集中点。每一个应用程序必须的UIApplication的只有一个实例(或UIApplication的一个子类)。当一个应用程序启动时,UIApplicationMain函数被调用;除其他任务,这个函数创建一个单独的UIApplication对象。然后你通过调用sharedApplication类方法访问该对象。一的UIApplication对象的主要作用是处理传入的用户事件的初始路由。它还调度转发给它的控制对象(UIControl)到相应的目标对象操作的消息。此外,的UIApplication对象维护所有的窗户(一个UIWindow对象)目前在该应用打开的列表,所以通过这些可检索任何应用程序的UIView的对象。该应用程序对象通常被分配一个委托,该显著运行事件,例如,应用程序启动,低内存警告,和应用程序的应用运筹学的终止,给它一个机会,作出适当反应的对象。应用程序可以协同地处理资源诸如电子邮件或通过的OpenURL图像文件:方法。例如,一个应用程序用此方法打开电子邮件URL可能导致邮件客户端,以启动并显示该消息。

typedef
NS_ENUM(NSInteger,UIStatusBarStyle) {
UIStatusBarStyleDefault =
0,
UIStatusBarStyleLightContent NS_ENUM_AVAILABLE_IOS(7_0) =1,

};

typedef
NS_ENUM(NSInteger,UIStatusBarAnimation) {
UIStatusBarAnimationNone,
#if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED
UIStatusBarAnimationFade,
UIStatusBarAnimationSlide,
#endif
};

typedef
NS_ENUM(NSInteger,UIInterfaceOrientation) {
UIInterfaceOrientationUnknown =
UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait =
UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown =
UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft =
UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight =
UIDeviceOrientationLandscapeLeft
};

UIKIT_EXTERN
NSString *const UIApplicationInvalidInterfaceOrientationExceptionNS_AVAILABLE_IOS(6_0);

typedef
NS_OPTIONS(NSUInteger,UIInterfaceOrientationMask) {
UIInterfaceOrientationMaskPortrait = (1 <<UIInterfaceOrientationPortrait),
UIInterfaceOrientationMaskLandscapeLeft = (1 <<UIInterfaceOrientationLandscapeLeft),
UIInterfaceOrientationMaskLandscapeRight = (1 <<UIInterfaceOrientationLandscapeRight),
UIInterfaceOrientationMaskPortraitUpsideDown = (1 <<UIInterfaceOrientationPortraitUpsideDown),
UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft |UIInterfaceOrientationMaskLandscapeRight),
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight |
UIInterfaceOrientationMaskPortraitUpsideDown),
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight),
};

#defineUIDeviceOrientationIsValidInterfaceOrientation(orientation)((UIDeviceOrientation)(orientation) == UIDeviceOrientationPortrait ||(UIDeviceOrientation)(orientation) == UIDeviceOrientationPortraitUpsideDown ||(UIDeviceOrientation)(orientation)
== UIDeviceOrientationLandscapeLeft ||(UIDeviceOrientation)(orientation) == UIDeviceOrientationLandscapeRight)

static
inline BOOLUIInterfaceOrientationIsPortrait(UIInterfaceOrientation orientation) {
return ((orientation)==
UIInterfaceOrientationPortrait || (orientation) ==
UIInterfaceOrientationPortraitUpsideDown);
}

static
inline BOOLUIInterfaceOrientationIsLandscape(UIInterfaceOrientation orientation) {
return ((orientation)==
UIInterfaceOrientationLandscapeLeft || (orientation) ==
UIInterfaceOrientationLandscapeRight);
}

typedef
NS_OPTIONS(NSUInteger,UIRemoteNotificationType) {
UIRemoteNotificationTypeNone = 0,
UIRemoteNotificationTypeBadge = 1 <<0,
UIRemoteNotificationTypeSound = 1 <<1,
UIRemoteNotificationTypeAlert = 1 <<2,
UIRemoteNotificationTypeNewsstandContentAvailability =
1 << 3,
} NS_ENUM_DEPRECATED_IOS(3_0,8_0,
"UseUIUserNotificationType for user notifications andregisterForRemoteNotifications for receiving remote notificationsinstead.");

typedef
NS_ENUM(NSUInteger,UIBackgroundFetchResult) {
UIBackgroundFetchResultNewData,
UIBackgroundFetchResultNoData,
UIBackgroundFetchResultFailed
} NS_ENUM_AVAILABLE_IOS(7_0);

typedef
NS_ENUM(NSInteger,UIBackgroundRefreshStatus) {
UIBackgroundRefreshStatusRestricted,
//< unavailable on this system due to deviceconfiguration; the user cannot enable the feature
UIBackgroundRefreshStatusDenied,
//<explicitly disabled by the user for this application
UIBackgroundRefreshStatusAvailable
//<enabled for this application
} NS_ENUM_AVAILABLE_IOS(7_0);

typedef
NS_ENUM(NSInteger,UIApplicationState) {
UIApplicationStateActive,
UIApplicationStateInactive,
UIApplicationStateBackground
} NS_ENUM_AVAILABLE_IOS(4_0);

typedef
NSUIntegerUIBackgroundTaskIdentifier;
UIKIT_EXTERN
const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
const NSTimeIntervalUIMinimumKeepAliveTimeout NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
const NSTimeIntervalUIApplicationBackgroundFetchIntervalMinimumNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
const NSTimeIntervalUIApplicationBackgroundFetchIntervalNeverNS_AVAILABLE_IOS(7_0);

typedef
NS_ENUM(NSInteger,UIUserInterfaceLayoutDirection) {
UIUserInterfaceLayoutDirectionLeftToRight,
UIUserInterfaceLayoutDirectionRightToLeft,
} NS_ENUM_AVAILABLE_IOS(5_0);

@class
UIView, UIWindow,
UIStatusBar, UIStatusBarWindow,
UILocalNotification;
@protocol
UIApplicationDelegate;

NS_CLASS_AVAILABLE_IOS(2_0)@interface UIApplication :
UIResponder <UIActionSheetDelegate>
{
@package
id <UIApplicationDelegate> _delegate;
NSMutableSet *_exclusiveTouchWindows;
UIEvent *_event;
UIEvent *_touchesEvent;
UIEvent *_motionEvent;
UIEvent *_remoteControlEvent;
NSInteger _remoteControlEventObservers;
NSArray *_topLevelNibObjects;
NSInteger _networkResourcesCurrentlyLoadingCount;
NSTimer *_hideNetworkActivityIndicatorTimer;
UIAlertView *_editAlertView;
UIStatusBar *_statusBar;
UIStatusBarStyle _statusBarRequestedStyle;
UIStatusBarWindow *_statusBarWindow;
NSMutableArray *_observerBlocks;
NSMutableArray *_postCommitActions;
NSString *_mainStoryboardName;
NSMutableArray *_tintViewDurationStack;
NSMutableArray *_statusBarTintColorLockingControllers;
NSInteger _statusBarTintColorLockingCount;
NSString *_preferredContentSizeCategory;
struct {
unsigned
intdeactivatingReasonFlags:11;
unsigned
int isSuspended:1;
unsigned
intisSuspendedEventsOnly:1;
unsigned
intisLaunchedSuspended:1;
unsigned
intcalledNonSuspendedLaunchDelegate:1;
unsigned
int calledSuspendedLaunchDelegate:1;
unsigned
int isHandlingURL:1;
unsigned
intstatusBarShowsProgress:1;
unsigned
int statusBarHidden:1;
unsigned
intstatusBarHiddenDefault:1;
unsigned
intstatusBarHiddenVerticallyCompact:1;
unsigned
intblockInteractionEvents:4;
unsigned
intreceivesMemoryWarnings:1;
unsigned
int showingProgress:1;
unsigned
intreceivesPowerMessages:1;
unsigned
intlaunchEventReceived:1;
unsigned
int activateEventReceived:1;
unsigned
intsystemIsAnimatingApplicationLifecycleEvent:1;//suspension, resumption, or system gesture
unsigned
int isActivating:1;
//launch or resume
unsigned
intisSuspendedUnderLock:1;
unsigned
intshouldExitAfterSendSuspend:1;
unsigned
int terminating:1;
unsigned
intisHandlingShortCutURL:1;
unsigned
intidleTimerDisabled:1;
unsigned
intdeviceOrientation:3;
unsigned
intdelegateShouldBeReleasedUponSet:1;
unsigned
intdelegateHandleOpenURL:1;
unsigned
int delegateOpenURL:1;
unsigned
intdelegateDidReceiveMemoryWarning:1;
unsigned
intdelegateWillTerminate:1;
unsigned
intdelegateSignificantTimeChange:1;
unsigned
intdelegateWillChangeInterfaceOrientation:1;
unsigned
intdelegateDidChangeInterfaceOrientation:1;
unsigned
intdelegateWillChangeStatusBarFrame:1;
unsigned
intdelegateDidChangeStatusBarFrame:1;
unsigned
intdelegateDeviceAccelerated:1;
unsigned
intdelegateDeviceChangedOrientation:1;
unsigned
intdelegateDidBecomeActive:1;
unsigned
intdelegateWillResignActive:1;
unsigned
intdelegateDidEnterBackground:1;
unsigned
int delegateDidEnterBackgroundWasSent:1;
unsigned
intdelegateWillEnterForeground:1;
unsigned
intdelegateWillSuspend:1;
unsigned
intdelegateDidResume:1;
unsigned
intdelegateSupportsStateRestoration:1;
unsigned
intdelegateSupportedInterfaceOrientations:1;
unsigned
intdelegateHandleSiriTask:1;
unsigned
intdelegateSupportsWatchKitRequests:1;
unsigned
intuserDefaultsSyncDisabled:1;
unsigned
intheadsetButtonClickCount:4;
unsigned
intisHeadsetButtonDown:1;
unsigned
intisFastForwardActive:1;
unsigned
int isRewindActive:1;
unsigned
int shakeToEdit:1;
unsigned
intzoomInClassicMode:1;
unsigned
intignoreHeadsetClicks:1;
unsigned
inttouchRotationDisabled:1;
unsigned
inttaskSuspendingUnsupported:1;
unsigned
inttaskSuspendingOnLockUnsupported:1;
unsigned
int isUnitTests:1;
unsigned
intrequiresHighResolution:1;
unsigned
int singleUseLaunchOrientation:3;
unsigned
intdefaultInterfaceOrientation:3;
unsigned
intsupportedInterfaceOrientationsMask:5;
unsigned
intdelegateWantsNextResponder:1;
unsigned
intisRunningInApplicationSwitcher:1;
unsigned
intisSendingEventForProgrammaticTouchCancellation:1;
unsigned
intdelegateWantsStatusBarTouchesEnded:1;
unsigned
intinterfaceLayoutDirectionIsValid:1;
unsigned
intinterfaceLayoutDirection:3;
unsigned
intrestorationExtended:1;
unsigned
intnormalRestorationInProgress:1;
unsigned
intnormalRestorationCompleted:1;
unsigned
intisDelayingTintViewChange:1;
unsigned
intisUpdatingTintViewColor:1;
unsigned
intisHandlingMemoryWarning:1;
unsigned
intforceStatusBarTintColorChanges:1;
unsigned
intdisableLegacyAutorotation:1;
unsigned
intisFakingForegroundTransitionForBackgroundFetch:1;
unsigned
intcouldNotRestoreStateWhenLocked:1;
unsigned
intdisableStyleOverrides:1;
unsigned
intlegibilityAccessibilitySettingEnabled:1;
unsigned
intviewControllerBasedStatusBarAppearance:1;
unsigned
intfakingRequiresHighResolution:1;
unsigned
intisStatusBarFading:1;
unsigned
intsystemWindowsSecure:1;
} _applicationFlags;
}

+ (UIApplication *)sharedApplicationNS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions whereappropriate instead.");

@property(nonatomic,assign)id<UIApplicationDelegate> delegate;

- (void)beginIgnoringInteractionEventsNS_EXTENSION_UNAVAILABLE_IOS(""); // nested. set should be
set during animations & transitions to ignoretouch and other events
- (void)endIgnoringInteractionEventsNS_EXTENSION_UNAVAILABLE_IOS("");
- (BOOL)isIgnoringInteractionEvents; // returns YES if we are at least one deep in ignoring events

@property(nonatomic,getter=isIdleTimerDisabled) BOOL idleTimerDisabled;
// default is NO

- (BOOL)openURL:(NSURL*)urlNS_EXTENSION_UNAVAILABLE_IOS("");
- (BOOL)canOpenURL:(NSURL *)urlNS_AVAILABLE_IOS(3_0);

- (void)sendEvent:(UIEvent *)event;

@property(nonatomic,readonly)UIWindow *keyWindow;
@property(nonatomic,readonly)NSArray *windows;

- (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent
*)event;

@property(nonatomic,getter=isNetworkActivityIndicatorVisible)BOOL networkActivityIndicatorVisible;//
showing network spinning gear in status bar. default is NO

//Setting the statusBarStyle does nothing if yourapplication is using the default UIViewController-based status bar system.
@property(nonatomic)UIStatusBarStylestatusBarStyle;
// default isUIStatusBarStyleDefault
- (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyleanimated:(BOOL)animated;

//Setting statusBarHidden does nothing if yourapplication is using the default UIViewController-based status bar system.
@property(nonatomic,getter=isStatusBarHidden)BOOL statusBarHidden;
- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animationNS_AVAILABLE_IOS(3_2);

//Rotate to a specific orientation. This only rotates the status bar and updatesthe statusBarOrientation property.
//This does not change automatically if the devicechanges orientation.
//Explicit setting of the status bar orientation is morelimited in iOS 6.0 and later.
@property(nonatomic)UIInterfaceOrientation statusBarOrientation;
- (void)setStatusBarOrientation:(UIInterfaceOrientation)interfaceOrientationanimated:(BOOL)animated;

//The system only calls this method if the applicationdelegate has not
//implemented the delegate equivalent. It returns theorientations specified by
//the application's info.plist. If no supported interfaceorientations were
//specified it will return UIInterfaceOrientationMaskAllon an iPad and
//UIInterfaceOrientationMaskAllButUpsideDown on aphone. The return value
//should be one of the UIInterfaceOrientationMask values whichindicates the
//orientations supported by this application.
- (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)windowNS_AVAILABLE_IOS(6_0);

@property(nonatomic,readonly)NSTimeIntervalstatusBarOrientationAnimationDuration;//
Returns the animation duration for the status bar during a 90 degreeorientation change. It should be doubledfor a 180 degree orientation change.
@property(nonatomic,readonly)CGRect statusBarFrame;
// returns CGRectZero if the status bar is hidden

@property(nonatomic)NSIntegerapplicationIconBadgeNumber;
// set to 0 to hide. default is 0. In iOS 8.0 and later,your application must register for user notifications using -[UIApplicationregisterUserNotificationSettings:] before being able to set the icon badge.

@property(nonatomic)BOOLapplicationSupportsShakeToEdit
NS_AVAILABLE_IOS(3_0);

@property(nonatomic,readonly)UIApplicationState applicationState
NS_AVAILABLE_IOS(4_0);
@property(nonatomic,readonly)NSTimeIntervalbackgroundTimeRemaining
NS_AVAILABLE_IOS(4_0);

- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler NS_AVAILABLE_IOS(4_0);
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithName:(NSString *)taskName expirationHandler:(void(^)(void))handlerNS_AVAILABLE_IOS(7_0);
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifierNS_AVAILABLE_IOS(4_0);

/*! The system guarantees that it will not wake up yourapplication for a background fetch more
frequently than the interval provided. Set toUIApplicationBackgroundFetchIntervalMinimum to be
woken as frequently as the system desires, or toUIApplicationBackgroundFetchIntervalNever (the
default) to never be woken for a background fetch.

This setter will have no effect unless your applicationhas the "fetch"
UIBackgroundMode. See the UIApplicationDelegate method
`application:performFetchWithCompletionHandler:` formore. */
- (void)setMinimumBackgroundFetchInterval:(NSTimeInterval)minimumBackgroundFetchIntervalNS_AVAILABLE_IOS(7_0);

/*! When background refresh is available for anapplication, it may launched or resumed in the background to handle significant
location changes, remote notifications, background fetches,etc. Observe UIApplicationBackgroundRefreshStatusDidChangeNotification to
be notified of changes. */
@property (nonatomic,readonly)
UIBackgroundRefreshStatus backgroundRefreshStatusNS_AVAILABLE_IOS(7_0);

- (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void(^)(void))keepAliveHandlerNS_AVAILABLE_IOS(4_0);
- (void)clearKeepAliveTimeout
NS_AVAILABLE_IOS(4_0);

@property(nonatomic,readonly,getter=isProtectedDataAvailable)BOOL
protectedDataAvailable NS_AVAILABLE_IOS(4_0);

@property(nonatomic,readonly)UIUserInterfaceLayoutDirection userInterfaceLayoutDirectionNS_AVAILABLE_IOS(5_0);

//Return the size category
@property(nonatomic,readonly)NSString*preferredContentSizeCategory
NS_AVAILABLE_IOS(7_0);

@end

@interface UIApplication(UIRemoteNotifications)

//Calling this will result in eitherapplication:didRegisterForRemoteNotificationsWithDeviceToken: orapplication:didFailToRegisterForRemoteNotificationsWithError: to be called onthe application delegate. Note: these
callbacks will be made only if theapplication has successfully registered for user notifications withregisterUserNotificationSettings:, or if it is enabled for Background AppRefresh.
- (void)registerForRemoteNotificationsNS_AVAILABLE_IOS(8_0);

- (void)unregisterForRemoteNotificationsNS_AVAILABLE_IOS(3_0);

//Returns YES if the application is currently registeredfor remote notifications, taking into account any systemwide settings; doesn'trelate to connectivity.
- (BOOL)isRegisteredForRemoteNotificationsNS_AVAILABLE_IOS(8_0);

- (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)typesNS_DEPRECATED_IOS(3_0,8_0,
"Please use registerForRemoteNotifications andregisterUserNotificationSettings: instead");

//Returns the enabled types, also taking into account anysystemwide settings; doesn't relate to connectivity.
- (UIRemoteNotificationType)enabledRemoteNotificationTypesNS_DEPRECATED_IOS(3_0,8_0,
"Please use -[UIApplicationisRegisteredForRemoteNotifications], or -[UIApplicationcurrentUserNotificationSettings] to retrieve user-enabled remote notificationand user notification settings");

@end

//In iOS 8.0 and later, your application must registerfor user notifications using -[UIApplication registerUserNotificationSettings:]before being able to schedule and present UILocalNotifications
@interface UIApplication(UILocalNotifications)

- (void)presentLocalNotificationNow:(UILocalNotification *)notificationNS_AVAILABLE_IOS(4_0);

- (void)scheduleLocalNotification:(UILocalNotification *)notificationNS_AVAILABLE_IOS(4_0); //copies
notification
- (void)cancelLocalNotification:(UILocalNotification *)notificationNS_AVAILABLE_IOS(4_0);
- (void)cancelAllLocalNotificationsNS_AVAILABLE_IOS(4_0);

@property(nonatomic,copy)NSArray*scheduledLocalNotifications
NS_AVAILABLE_IOS(4_0);
// setter added in iOS 4.2

@end

@class
UIUserNotificationSettings;
@interface UIApplication(UIUserNotificationSettings)

//Registering UIUserNotificationSettings more than onceresults in previous settings being overwritten.
- (void)registerUserNotificationSettings:(UIUserNotificationSettings *)notificationSettingsNS_AVAILABLE_IOS(8_0);

//Returns the enabled user notification settings, alsotaking into account any systemwide settings.
- (UIUserNotificationSettings *)currentUserNotificationSettingsNS_AVAILABLE_IOS(8_0);

@end

@interface UIApplication(UIRemoteControlEvents)

- (void)beginReceivingRemoteControlEventsNS_AVAILABLE_IOS(4_0);
- (void)endReceivingRemoteControlEventsNS_AVAILABLE_IOS(4_0);

@end

@interface UIApplication(UINewsstand)
- (void)setNewsstandIconImage:(UIImage *)image;
@end

@protocol
UIStateRestoring;
@interface UIApplication(UIStateRestoration)
//These methods are used to inform the system that staterestoration is occuring asynchronously after the application
//has processed its restoration archive on launch. In theeven of a crash, the system will be able to detect that it may
//have been caused by a bad restoration archive andarrange to ignore it on a subsequent application launch.
- (void)extendStateRestoration NS_AVAILABLE_IOS(6_0);
- (void)completeStateRestoration NS_AVAILABLE_IOS(6_0);

//Indicate the application should not use the snapshot onnext launch, even if there is a valid state restoration archive.
//This should only be called from methods invoked fromState Preservation, else it is ignored.
- (void)ignoreSnapshotOnNextApplicationLaunchNS_AVAILABLE_IOS(7_0);

//Register non-View/ViewController objects for staterestoration so other objects can reference them within state restorationarchives.
//If the object implements encode/decode, those methodswill be called during save/restore.
//Obj and identifier must not be nil, or will raiseUIRestorationObjectRegistrationException.
//Objects do not need to be unregistered when they aredeleted, the State Restoration system will notice and stop tracking the object.
+ (void)registerObjectForStateRestoration:(id<UIStateRestoring>)objectrestorationIdentifier:(NSString
*)restorationIdentifier NS_AVAILABLE_IOS(7_0);
@end

@protocolUIApplicationDelegate<NSObject>

@optional

- (void)applicationDidFinishLaunching:(UIApplication *)application;
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary*)launchOptionsNS_AVAILABLE_IOS(6_0);
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptionsNS_AVAILABLE_IOS(3_0);

- (void)applicationDidBecomeActive:(UIApplication *)application;
- (void)applicationWillResignActive:(UIApplication *)application;
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; // Will be deprecated at some point,
pleasereplace with application:openURL:sourceApplication:annotation:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString*)sourceApplication
annotation:(id)annotation
NS_AVAILABLE_IOS(4_2);
// no equiv.notification. return NO if the application can't open for some reason

- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application; // try to clean up as much memory as possible. next stepis to terminate
app
- (void)applicationWillTerminate:(UIApplication *)application;
- (void)applicationSignificantTimeChange:(UIApplication*)application; // midnight, carrier time update, daylight savings timechange

- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation;

- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame; // inscreen
coordinates
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame;

//This callback will be made upon calling -[UIApplicationregisterUserNotificationSettings:]. The settings the user has granted to theapplication will be passed in as the second argument.
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettingsNS_AVAILABLE_IOS(8_0);

- (void)application:(UIApplication *)applicationdidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceTokenNS_AVAILABLE_IOS(3_0);

- (void)application:(UIApplication *)applicationdidFailToRegisterForRemoteNotificationsWithError:(NSError *)errorNS_AVAILABLE_IOS(3_0);

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary*)userInfoNS_AVAILABLE_IOS(3_0);

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notificationNS_AVAILABLE_IOS(4_0);

//Called when your app has been activated by the userselecting an action from a local notification.
//A nil action identifier indicates the default action.
//You should call the completion handler as soon asyou've finished handling the action.
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifierforLocalNotification:(UILocalNotification
*)notification completionHandler:(void(^)())completionHandlerNS_AVAILABLE_IOS(8_0);

//Called when your app has been activated by the userselecting an action from a remote notification.
//A nil action identifier indicates the default action.
//You should call the completion handler as soon asyou've finished handling the action.
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifierforRemoteNotification:(NSDictionary
*)userInfo completionHandler:(void(^)())completionHandlerNS_AVAILABLE_IOS(8_0);

/*! This delegate method offers an opportunity forapplications with the "remote-notification" background mode to fetchappropriate new data in response to an incoming remote notification. You shouldcall the fetchCompletionHandler
as soon as you're finished performing thatoperation, so the system can accurately estimate its power and data cost.

This method will be invoked even if the application waslaunched or resumed because of the remote notification. The respective delegatemethods will be invoked first. Note that this behavior is in contrast toapplication:didReceiveRemoteNotification:,
which is not called in those cases,and which will not be invoked if this method is implemented. !*/
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary*)userInfo fetchCompletionHandler:(void
(^)(UIBackgroundFetchResult result))completionHandlerNS_AVAILABLE_IOS(7_0);

///Applications with the "fetch" background modemay be given opportunities to fetch updated content in the background or whenit is convenient for the system. This method will be called in thesesituations. You should
call the fetchCompletionHandler as soon as you'refinished performing that operation, so the system can accurately estimate itspower and data cost.
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult
result))completionHandler NS_AVAILABLE_IOS(7_0);

//Applications using an NSURLSession with a backgroundconfiguration may be launched or resumed in the background in order to handlethe
//completion of tasks in that session, or to handleauthentication. This method will be called with the identifier of the sessionneeding
//attention. Once a session has been created from aconfiguration object with that identifier, the session's delegate will beginreceiving
//callbacks. If such a session has already been created(if the app is being resumed, for instance), then the delegate will startreceiving
//callbacks without any action by the application. Youshould call the completionHandler as soon as you're finished handling thecallbacks.
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifiercompletionHandler:(void
(^)())completionHandler NS_AVAILABLE_IOS(7_0);

- (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary*)userInfo reply:(void(^)(NSDictionary
*replyInfo))reply NS_AVAILABLE_IOS(8_2);

- (void)applicationDidEnterBackground:(UIApplication *)applicationNS_AVAILABLE_IOS(4_0);
- (void)applicationWillEnterForeground:(UIApplication *)applicationNS_AVAILABLE_IOS(4_0);

- (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication*)applicationNS_AVAILABLE_IOS(4_0);
- (void)applicationProtectedDataDidBecomeAvailable:(UIApplication*)application NS_AVAILABLE_IOS(4_0);

@property (nonatomic,retain)
UIWindow *windowNS_AVAILABLE_IOS(5_0);

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window NS_AVAILABLE_IOS(6_0);

//Applications may reject specific types of extensionsbased on the extension point identifier.
//Constants representing common extension pointidentifiers are provided further down.
//If unimplemented, the default behavior is to allow theextension point identifier.
- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString*)extensionPointIdentifierNS_AVAILABLE_IOS(8_0);

#pragma mark -- State Restoration protocol adopted byUIApplication delegate --

- (UIViewController *) application:(UIApplication *)applicationviewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents
coder:(NSCoder *)coder
NS_AVAILABLE_IOS(6_0);
- (BOOL) application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);
- (BOOL) application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);
- (void) application:(UIApplication *)application willEncodeRestorableStateWithCoder:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);
- (void) application:(UIApplication *)application didDecodeRestorableStateWithCoder:(NSCoder *)coderNS_AVAILABLE_IOS(6_0);

#pragma mark -- User Activity Continuation protocoladopted by UIApplication delegate --

//Called on the main thread as soon as the user indicatesthey want to continue an activity in your application. The NSUserActivityobject may not be available instantly,
//so use this as an opportunity to show the user that anactivity will be continued shortly.
//For each application:willContinueUserActivityWithType:invocation, you are guaranteed to get exactly one invocation ofapplication:continueUserActivity: on success,
//orapplication:didFailToContinueUserActivityWithType:error: if an error wasencountered.
- (BOOL)application:(UIApplication *)application willContinueUserActivityWithType:(NSString*)userActivityTypeNS_AVAILABLE_IOS(8_0);

//Called on the main thread after the NSUserActivityobject is available. Use the data you stored in the NSUserActivity object tore-create what the user was doing.
//You can create/fetch any restorable objects associatedwith the user activity, and pass them to the restorationHandler. They will thenhave the UIResponder restoreUserActivityState: method
//invoked with the user activity. Invoking the restorationHandleris optional. It may be copied and invoked later, and it will bounce to the mainthread to complete its work and call
//restoreUserActivityState on all objects.
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity*)userActivity restorationHandler:(void(^)(NSArray
*restorableObjects))restorationHandler NS_AVAILABLE_IOS(8_0);

//If the user activity cannot be fetched afterwillContinueUserActivityWithType is called, this will be called on the main threadwhen implemented.
- (void)application:(UIApplication *)application didFailToContinueUserActivityWithType:(NSString*)userActivityType error:(NSError
*)error NS_AVAILABLE_IOS(8_0);

//This is called on the main thread when a user activitymanaged by UIKit has been updated. You can use this as a last chance to addadditional data to the userActivity.
- (void)application:(UIApplication *)application didUpdateUserActivity:(NSUserActivity*)userActivityNS_AVAILABLE_IOS(8_0);
@end

@interfaceUIApplication(UIApplicationDeprecated)

@property(nonatomic,getter=isProximitySensingEnabled)BOOL proximitySensingEnabledNS_DEPRECATED_IOS(2_0,3_0);
// default isNO. see UIDevice for replacement
- (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animatedNS_DEPRECATED_IOS(2_0,3_2);
// use -setStatusBarHidden:withAnimation:

@end

//If nil is specified for principalClassName, the valuefor NSPrincipalClass from the Info.plist is used. If there is no
//NSPrincipalClass key specified, the UIApplication classis used. The delegate class will be instantiated using init.
UIKIT_EXTERN
intUIApplicationMain(int argc,
char *argv[], NSString *principalClassName,NSString *delegateClassName);

UIKIT_EXTERN
NSString *constUITrackingRunLoopMode;

//These notifications are sent out after the equivalentdelegate message is called
UIKIT_EXTERN
NSString *constUIApplicationDidEnterBackgroundNotification NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
NSString *constUIApplicationWillEnterForegroundNotification NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
NSString *constUIApplicationDidFinishLaunchingNotification;
UIKIT_EXTERN
NSString *constUIApplicationDidBecomeActiveNotification;
UIKIT_EXTERN
NSString *constUIApplicationWillResignActiveNotification;
UIKIT_EXTERN
NSString *constUIApplicationDidReceiveMemoryWarningNotification;
UIKIT_EXTERN
NSString *constUIApplicationWillTerminateNotification;
UIKIT_EXTERN
NSString *constUIApplicationSignificantTimeChangeNotification;
UIKIT_EXTERN
NSString *constUIApplicationWillChangeStatusBarOrientationNotification;// userInfo contains NSNumber with new orientation
UIKIT_EXTERN
NSString *constUIApplicationDidChangeStatusBarOrientationNotification; //userInfo contains NSNumber with old orientation
UIKIT_EXTERN
NSString *constUIApplicationStatusBarOrientationUserInfoKey; // userInfo dictionary key for status bar orientation
UIKIT_EXTERN
NSString *constUIApplicationWillChangeStatusBarFrameNotification; // userInfo contains NSValue with new frame
UIKIT_EXTERN
NSString *constUIApplicationDidChangeStatusBarFrameNotification; // userInfo contains NSValue with old frame
UIKIT_EXTERN
NSString *constUIApplicationStatusBarFrameUserInfoKey; // userInfo dictionary key for status bar frame
UIKIT_EXTERN
NSString *constUIApplicationBackgroundRefreshStatusDidChangeNotificationNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsURLKey NS_AVAILABLE_IOS(3_0);// userInfo contains NSURL with
launch URL
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsSourceApplicationKey NS_AVAILABLE_IOS(3_0);// userInfocontains NSString with
launch app bundle ID
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsRemoteNotificationKey NS_AVAILABLE_IOS(3_0);// userInfocontains NSDictionary
with payload
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsLocalNotificationKey NS_AVAILABLE_IOS(4_0);// userInfocontains a UILocalNotification
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsAnnotationKey NS_AVAILABLE_IOS(3_2);// userInfo contains object with
annotation property list
UIKIT_EXTERN
NSString *constUIApplicationProtectedDataWillBecomeUnavailable NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
NSString *constUIApplicationProtectedDataDidBecomeAvailable NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsLocationKey NS_AVAILABLE_IOS(4_0);// app was launched in response
to a CoreLocation event.
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsNewsstandDownloadsKey NS_AVAILABLE_IOS(5_0);// userInfocontains an NSArray
of NKAssetDownload identifiers
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsBluetoothCentralsKey NS_AVAILABLE_IOS(7_0);// userInfocontains an NSArray
of CBCentralManager restore identifiers
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsBluetoothPeripheralsKey NS_AVAILABLE_IOS(7_0);// userInfocontains an NSArray
of CBPeripheralManager restore identifiers

//Key in options dict passed to application:[will |did]FinishLaunchingWithOptions and info forUIApplicationDidFinishLaunchingNotification
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsUserActivityDictionaryKey NS_AVAILABLE_IOS(8_0);//Sub-Dictionary present in
launch options when user activity is present
UIKIT_EXTERN
NSString *constUIApplicationLaunchOptionsUserActivityTypeKey NS_AVAILABLE_IOS(8_0);// Key in user activity dictionary
for the activity type

UIKIT_EXTERN
NSString *constUIApplicationOpenSettingsURLStringNS_AVAILABLE_IOS(8_0);

//Content size category constants
UIKIT_EXTERN
NSString *constUIContentSizeCategoryExtraSmallNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategorySmallNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryMediumNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *const UIContentSizeCategoryExtraLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryExtraExtraLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryExtraExtraExtraLargeNS_AVAILABLE_IOS(7_0);

//Accessibility sizes
UIKIT_EXTERN
NSString *constUIContentSizeCategoryAccessibilityMediumNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryAccessibilityLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryAccessibilityExtraLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryAccessibilityExtraExtraLargeNS_AVAILABLE_IOS(7_0);
UIKIT_EXTERN
NSString *constUIContentSizeCategoryAccessibilityExtraExtraExtraLargeNS_AVAILABLE_IOS(7_0);

//Notification is emitted when the user has changed thepreferredContentSizeCategory for the system
UIKIT_EXTERN
NSString *constUIContentSizeCategoryDidChangeNotificationNS_AVAILABLE_IOS(7_0);// userInfo dictionary will contain new
value forUIContentSizeCategoryNewValueKey
UIKIT_EXTERN
NSString *constUIContentSizeCategoryNewValueKeyNS_AVAILABLE_IOS(7_0);// NSStringinstance with new content size category
in userInfo

//This notification is posted after the user takes ascreenshot (for example by pressing both the home and lock screen buttons)
UIKIT_EXTERN
NSString *constUIApplicationUserDidTakeScreenshotNotificationNS_AVAILABLE_IOS(7_0);

//Extension point identifier constants
UIKIT_EXTERN
NSString *constUIApplicationKeyboardExtensionPointIdentifierNS_AVAILABLE_IOS(8_0);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: