通知
2016-04-05 17:36
351 查看
1.通知(能委托不通知)
1.1作用:完成对象之间的消息传递
1.2核心理念
1.通知的发送方式不知道接收方是谁,只需要将通知发给通知中心即可;
2.通知的接收方不知道发送方是谁,只需要提前向通知中心订阅某一个通知即可;
3.一旦通知的发送方真的发出了通知,则有通知中心负责将这个通知推送给负责给所有订阅了该通知的对象;
1.3通知和委托的对比:
1.代理只是两个对象之间。私密的消息的传递;
2.通知可以是一个对象对多个对象的消息传递,但彼此并不知道对方的存在;
1.4核心对象
1.通知中心:NSNotificationCenter(单例,系统自动创建好的)
2.通知NSNotification
1.5系统提供的通知:键盘通知
1.系统会在键盘弹起和收回时自动发出通知
键盘通知的名字:
键盘弹起:
UIKeyBoardWillShowNotification
UIKeyBoardDidShowNotification
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = “0.25”;
UIKeyboardBoundsUserInfoKey = “NSRect: {{0, 0}, {414, 271}}”;
UIKeyboardCenterBeginUserInfoKey = “NSPoint: {207, 871.5}”;
UIKeyboardCenterEndUserInfoKey = “NSPoint: {207, 600.5}”;
UIKeyboardFrameBeginUserInfoKey = “NSRect: {{0, 736}, {414, 271}}”;
UIKeyboardFrameEndUserInfoKey = “NSRect: {{0, 465}, {414, 271}}”;
UIKeyboardIsLocalUserInfoKey = 1;
键盘收回:
UIKeyBoardWillHideNotification
UIKeyBoardDidHideNotification
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = “0.25”;
UIKeyboardBoundsUserInfoKey = “NSRect: {{0, 0}, {414, 271}}”;
UIKeyboardCenterBeginUserInfoKey = “NSPoint: {207, 600.5}”;
UIKeyboardCenterEndUserInfoKey = “NSPoint: {207, 871.5}”;
UIKeyboardFrameBeginUserInfoKey = “NSRect: {{0, 465}, {414, 271}}”;
UIKeyboardFrameEndUserInfoKey = “NSRect: {{0, 736}, {414, 271}}”;
UIKeyboardIsLocalUserInfoKey = 1;
2.在不用的时候要注销通知发送
1.1作用:完成对象之间的消息传递
1.2核心理念
1.通知的发送方式不知道接收方是谁,只需要将通知发给通知中心即可;
2.通知的接收方不知道发送方是谁,只需要提前向通知中心订阅某一个通知即可;
3.一旦通知的发送方真的发出了通知,则有通知中心负责将这个通知推送给负责给所有订阅了该通知的对象;
1.3通知和委托的对比:
1.代理只是两个对象之间。私密的消息的传递;
2.通知可以是一个对象对多个对象的消息传递,但彼此并不知道对方的存在;
1.4核心对象
1.通知中心:NSNotificationCenter(单例,系统自动创建好的)
2.通知NSNotification
1.5系统提供的通知:键盘通知
1.系统会在键盘弹起和收回时自动发出通知
键盘通知的名字:
键盘弹起:
UIKeyBoardWillShowNotification
UIKeyBoardDidShowNotification
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = “0.25”;
UIKeyboardBoundsUserInfoKey = “NSRect: {{0, 0}, {414, 271}}”;
UIKeyboardCenterBeginUserInfoKey = “NSPoint: {207, 871.5}”;
UIKeyboardCenterEndUserInfoKey = “NSPoint: {207, 600.5}”;
UIKeyboardFrameBeginUserInfoKey = “NSRect: {{0, 736}, {414, 271}}”;
UIKeyboardFrameEndUserInfoKey = “NSRect: {{0, 465}, {414, 271}}”;
UIKeyboardIsLocalUserInfoKey = 1;
键盘收回:
UIKeyBoardWillHideNotification
UIKeyBoardDidHideNotification
UIKeyboardAnimationCurveUserInfoKey = 7;
UIKeyboardAnimationDurationUserInfoKey = “0.25”;
UIKeyboardBoundsUserInfoKey = “NSRect: {{0, 0}, {414, 271}}”;
UIKeyboardCenterBeginUserInfoKey = “NSPoint: {207, 600.5}”;
UIKeyboardCenterEndUserInfoKey = “NSPoint: {207, 871.5}”;
UIKeyboardFrameBeginUserInfoKey = “NSRect: {{0, 465}, {414, 271}}”;
UIKeyboardFrameEndUserInfoKey = “NSRect: {{0, 736}, {414, 271}}”;
UIKeyboardIsLocalUserInfoKey = 1;
2.在不用的时候要注销通知发送
相关文章推荐
- AAA功能部署和测试----麒麟开源堡垒机功能篇之二
- 关于PDO--数据库抽象层
- Maven常用命令介绍
- 客户端使用axis调用webService服务端
- POJ2376-Cleaning Shifts
- marathon参考(3)服务发现和负载均衡
- 可重入概念
- 线性表的应用1(顺序表的遍历和查找)
- centos下安装php
- mysql5中大数据错误:Packet for query is too large (1117260 > 1048576). You can change this value on the ser
- Elementary0.3.2/Ubuntu14.04安装GooglePinYin输入法
- 判断字符串回环变位
- Python3.5入门学习记录-条件控制
- linux远程命令行安装matlab
- Android音视频录制类MediaRecorder用法举例
- 将UIDatePicker的日期显示为数字和中文
- 如何创建新的FreeRTOS工程
- Eclipse 重构
- 10gRAC修改vip,public ip
- 《剑指Offer》学习笔记——从尾到头打印链表