通知

1.通知(能委托不通知)
1.1作用:完成对象之间的消息传递
1.2核心理念
1.通知的发送方式不知道接收方是谁,只需要将通知发给通知中心即可;
2.通知的接收方不知道发送方是谁,只需要提前向通知中心订阅某一个通知即可;
3.一旦通知的发送方真的发出了通知,则有通知中心负责将这个通知推送给负责给所有订阅了该通知的对象;
1.3通知和委托的对比:
1.代理只是两个对象之间。私密的消息的传递;
2.通知可以是一个对象对多个对象的消息传递,但彼此并不知道对方的存在;
1.4核心对象
1.通知中心:NSNotificationCenter(单例,系统自动创建好的)
2.通知NSNotification
1.5系统提供的通知:键盘通知
1.系统会在键盘弹起和收回时自动发出通知
键盘通知的名字:
键盘弹起:
UIKeyBoardWillShowNotification
UIKeyBoardDidShowNotification

  1. 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

  1. 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.在不用的时候要注销通知发送

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值