ios开发——日常之可用通知监听的系统事件

一、UIApplication 的相关事件

//注册应用进入后台的通知

[[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(StopRecord:)

                                                 name:UIApplicationDidEnterBackgroundNotification object:nil];


//注册应用使用系统截屏的通知(home键+锁屏键)

[[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(StopRecord:)

                                                 name:UIApplicationUserDidTakeScreenshotNotification object:nil];





等等。。。



二、UIKeyboard 的相关事件

//注册键盘出现的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(handleKeyboardWillShowNotification:)

                                                 name:UIKeyboardWillShowNotification

                                               object:nil];

    //注册键盘消失的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                             selector:@selector(handleKeyboardWillHideNotification:)

                                                 name:UIKeyboardWillHideNotification

                                               object:nil];

    //注册键盘frame已经改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIKeyboardDidChangeFrameNotification

                                                object:nil];


等等。。。


三、NSTextStorage 的相关事件


//注册NSTextStorage将要编辑的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:NSTextStorageWillProcessEditingNotification

                                                object:nil];



//注册NSTextStorage已经编辑的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:NSTextStorageDidProcessEditingNotification

                                                object:nil];

等等。。。



四、UIAccessibility 的相关事件

//辅助功能  VoiceOver


[[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIAccessibilityDarkerSystemColorsStatusDidChangeNotification

                                                object:nil];



[[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIAccessibilityScreenChangedNotification

                                                object:nil];

等等。。。



五、UIDevice  的相关事件

//注册设备屏幕方向改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIDeviceOrientationDidChangeNotification

                                                object:nil];


等等。。。


六、 UIDocument  的相关事件

//注册 状态改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIDocumentStateChangedNotification

                                                object:nil];


等等。。。


七、UIMenuController   的相关事件

//注册 菜单控制器将要显示菜单 的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

                                                name:UIMenuControllerWillShowMenuNotification

                                                object:nil];


等等。。。


八、 UIPasteboard  的相关事件

//注册 粘贴板 改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UIPasteboardChangedNotification

                                                object:nil];


等等。。。


九、 UIScreenMode  的相关事件

//注册 屏幕模式 改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UIScreenModeDidChangeNotification

                                                object:nil];


等等。。。


十、 UITableView 的相关事件

//注册 改变的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UITableViewSelectionDidChangeNotification

                                                object:nil];


等等。。。


十、 UITextField 的相关事件

//注册 UITextField文本开始编辑 的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UITextFieldTextDidBeginEditingNotification

                                                object:nil];


等等。。。


十一、 UITextInput 的相关事件

//注册  的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UITextInputCurrentInputModeDidChangeNotification

                                                object:nil];


等等。。。


十二、 UITextView 的相关事件

//注册 UITextView文本开始编辑 的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UITextViewTextDidBeginEditingNotification

                                                object:nil];


等等。。。


十三、 UIViewController 的相关事件

//注册  的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UIViewControllerShowDetailTargetDidChangeNotification

                                                object:nil];


等等。。。


十四、 UIWindow 的相关事件

//注册 UIWindow变为可见 的通知

    [[NSNotificationCenter defaultCenter] addObserver:self

                                                selector:@selector(keyboardDidChangeFrame:)

      name:UIWindowDidBecomeVisibleNotification

                                                object:nil];


等等。。。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值