//在main函数上面定义一个观察类,并实现了一个方法观察通知
@interface Observe : NSObject
- (void)iwatch:(NSNotification *)note;
@end
@implementation Observe
- (void)iwatch:(NSNotification *)note
{ NSLog(@"name: %@\n object is :%@",note.name, [note.object class]);
}
@end
//在main函数中实例化一个观察对象,并注册到默认通知中心
int main(int argc, char * argv[]) {
@autoreleasepool {
Observe *observor = [[Observe alloc]init];
[[NSNotificationCenter defaultCenter] addObserver:observor selector:@selector(iwatch:) name:nil object:nil];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
/*App启动后的Log信息, 根视图控制器使用Xib文件初始化*/
2013
-
12
-
20
19
:
45
:
21.162
animateSummary[
3142
:a0b] name: NSUserDefaultsDidChangeNotification object is :NSUserDefaults
//文档中的说明:当一个持久域中的默认值被改变时发出.来自NSUserDefaults对象,不包含userinfo.
2013
-
12
-
20
19
:
45
:
21.448
animateSummary[
3142
:a0b] name: NSBundleDidLoadNotification
object is :NSBundle
//userinfo字典包含一个 NSLoadClasses 键;
2013
-
12
-
20
19
:
45
:
21.454
animateSummary[
3142
:
1003
] name: AccessibilitySettingsLoaderDidUpdateSettings object is :(null)
//查不到
2013
-
12
-
20
19
:
45
:
21.554
animateSummary[
3142
:a0b] Cannot find executable
for
CFBundle
0x8e92e30
</Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7
.0
.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
//App启动后的一个提示.
2013
-
12
-
20
19
:
45
:
21.563
animateSummary[
3142
:a0b] name: _UIWindowDidCreateWindowContextNotification object is :UIStatusBarWindow
//状态栏的window创建了.
2013
-
12
-
20
19
:
45
:
21.631
animateSummary[
3142
:a0b] name: UIApplicationWillChangeStatusBarFrameNotification object is :UIApplication
//状态栏的frame将要设定.
2013
-
12
-
20
19
:
45
:
21.632
animateSummary[
3142
:a0b] name: UIApplicationStatusBarHeightChangedNotification object is :UIApplication
//状态栏高度发生改变
2013
-
12
-
20
19
:
45
:
21.633
animateSummary[
3142
:a0b] name: UIApplicationDidChangeStatusBarFrameNotification object is :UIApplication
//状态栏设定完成
2013
-
12
-
20
19
:
45
:
21.634
animateSummary[
3142
:a0b] name: UIWindowDidBecomeVisibleNotification object is :UIStatusBarWindow
//状态栏可见.
2013
-
12
-
20
19
:
45
:
21.650
animateSummary[
3142
:a0b] name: _UIWindowDidCreateWindowContextNotification object is :UIWindow
//window实例化.
2013
-
12
-
20
19
:
45
:
21.651
animateSummary[
3142
:a0b] name: UIWindowDidBecomeVisibleNotification object is :UIWindow
//window可见化.
2013
-
12
-
20
19
:
45
:
21.651
animateSummary[
3142
:a0b] name: UIWindowDidBecomeKeyNotification object is :UIWindow
//设置为主window
2013
-
12
-
20
19
:
45
:
21.668
animateSummary[
3142
:a0b] name: UIApplicationDidFinishLaunchingNotification object is :UIApplication
//应用完成加载
2013
-
12
-
20
19
:
45
:
21.668
animateSummary[
3142
:a0b] name: _UIApplicationDidRemoveDeactivationReasonNotification object is :UIApplication
//
2013
-
12
-
20
19
:
45
:
21.669
animateSummary[
3142
:a0b] name: UIApplicationDidBecomeActiveNotification object is :UIApplication
//应用进入活动状态.
2013
-
12
-
20
19
:
45
:
21.671
animateSummary[
3142
:a0b] name: UIDeviceOrientationDidChangeNotification object is :UIDevice
//设备朝向完成改变.
2013
-
12
-
20
19
:
45
:
21.674
animateSummary[
3142
:a0b] name: UIApplicationDidEndResumeAnimationNotification object is :UIApplication
//应用完成动画效果启动.
2013
-
12
-
20
19
:
45
:
22.308
animateSummary[
3142
:a0b] name: _UIWindowDidCreateWindowContextNotification object is :UITextEffectsWindow
//
2013
-
12
-
20
19
:
45
:
22.309
animateSummary[
3142
:a0b] name: UITextEffectsWindowDidRotateNotification object is :UITextEffectsWindow
//
2013
-
12
-
20
19
:
45
:
23.541
animateSummary[
3142
:a0b] name: NSUserDefaultsDidChangeNotification object is :NSUserDefaults
//用户默认设置改变
2013
-
12
-
20
19
:
45
:
23.544
animateSummary[
3142
:
3
b0b] name: NSWillBecomeMultiThreadedNotification object is :(null)
//开启多线程
/*当home键被按下时*/
2013
-
12
-
20
20
:
04
:
17.188
animateSummary[
3142
:a0b] name: UIApplicationWillBeginSuspendAnimationNotification object is :UIApplication
//挂起动画效果
2013
-
12
-
20
20
:
04
:
17.800
animateSummary[
3142
:a0b] name: _UIApplicationWillAddDeactivationReasonNotification object is :UIApplication
//
2013
-
12
-
20
20
:
04
:
17.801
animateSummary[
3142
:a0b] name: UIApplicationWillResignActiveNotification object is :UIApplication
//将要退出活动状态.
2013
-
12
-
20
20
:
04
:
17.894
animateSummary[
3142
:a0b] name: UIApplicationSuspendedNotification object is :UIApplication
//
2013
-
12
-
20
20
:
04
:
17.895
animateSummary[
3142
:a0b] name: UIApplicationDidEnterBackgroundNotification object is :UIApplication
//应用进去后台.
2013
-
12
-
20
20
:
04
:
17.896
animateSummary[
3142
:a0b] name: UIStatusBarStyleOverridesDidChangeNotification object is :(null)
//状态条样式重写完成.
2013
-
12
-
20
20
:
04
:
18.000
animateSummary[
3142
:a0b] name: UIStatusBarStyleOverridesDidChangeNotification object is :(null)
//
2013
-
12
-
20
20
:
04
:
18.000
animateSummary[
3142
:a0b] name: _UIApplicationDidFinishSuspensionSnapshotNotification object is :UIApplication
//应用冻结.
2013
-
12
-
20
20
:
04
:
18.001
animateSummary[
3142
:a0b] name: UIKeyboardCandidateCorrectionDidChangeNotification object is :(null)
//候选键盘改变.
2013
-
12
-
20
20
:
04
:
18.001
animateSummary[
3142
:a0b] name: UIKeyboardCandidateCorrectionDidChangeNotification object is :(null)
//
2013
-
12
-
20
20
:
04
:
18.002
animateSummary[
3142
:a0b] name: _UIWindowWillDestroyWindowContextNotification object is :UIStatusBarWindow
//状态栏销毁window环境
2013
-
12
-
20
20
:
04
:
18.002
animateSummary[
3142
:a0b] name: _UIWindowWillDestroyWindowContextNotification object is :UIWindow
//window销毁window环境
2013
-
12
-
20
20
:
04
:
18.003
animateSummary[
3142
:a0b] name: _UIWindowWillDestroyWindowContextNotification
object is :UITextEffectsWindow
//..