E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
NSNotification
NSNotificationCenter
最主要的两个类:NSNotificationCenter&NSNotificationNSNotificationCenter:通知中心是一个单例
NSNotification
:通知对象,里面有通知的信息
小小白衣
·
2020-03-11 02:58
iOS开发基础:消息传递机制的不同与缺陷
图片发自AppiOS中的消息传递机制有以下几种:代理(Delegation)通知(
NSNotification
)BLOCKKVO(key-valueobserving)Target-Action这么多的消息传递机制
溪石iOS
·
2020-03-10 10:07
Local Notification(本地通知)
这里说的推送通知和
NSNotification
是有所区别的,
NSNotification
是抽象的,不可见的。而推送通知是可见的,能用肉眼看到。
温暖C
·
2020-03-09 10:28
10.iOS开发中的技巧
侧重基础如KVC,通知等,以及面试技巧等1.View处理方面1.iOS自定义View注意事项2.基础语法使用等1.KVO的使用2.界面间传值的几种方式(Delegate/
NSNotification
/Block
小白哥有话说
·
2020-03-09 00:12
键值观察者_KVO
KeyValueObserving,顾名思义就是一种observer(观察)模式用于监听property(属性)的变化,KVO跟
NSNotification
有很多相似的地方.用addObserver:forKeyPath
by小杰
·
2020-03-08 20:14
通知 -
NSNotification
简述:类似KVO,监听对象系统的Notification例如:系统键盘的UIKeyboardDidChangeFrameNotification1注册通知:需要在通知中心注册使用。//举例使用输入框弹出键盘。UITextField*testField=[[UITextFieldalloc]initWithFrame:CGRectMake(0,100,100,40)];testField.backg
居然是村长
·
2020-03-08 19:59
KVO,
NSNotification
,delegate及block区别
NSNotification
通知,也是一对多的使用场景。在某些情况下,KVO和
NSNotification
是一样的,都是状态变化之后告知对方。
潘光吉come_on
·
2020-03-08 11:35
判断textfild 的字段是否过长
#pragmamark判断textfild的字段是否过长-(void)textFiledEditChanged:(
NSNotification
*)obj{UITextField*textField=(UITextField
夏夏的一些事
·
2020-03-07 05:45
UIView中怎么注册销毁
NSNotification
通知
今天做一个图片选择器的时候,点在一个缩略图才需要创建展示大图的容器View。因为想支持横屏,所以需要注册系统通知,做frame坐标的变换。-(void)willMoveToWindow:(UIWindow*)newWindow{if(newWindow==nil){//Willberemovedfromwindow,similarto-viewDidUnload.//Unsubscribefrom
苏永茂
·
2020-03-06 17:17
常用设计模式
通知
NSNotification
通知由消息中心发送消息中心在整个工程中有且只有一个消息中心可以发送多条消息可以在工程中的任何位置接收消息通过消息的名称区分消息消息的名字是消息的唯一标识1>为消息中心添加观察者
DVWang
·
2020-03-06 09:22
UITextField判断是否正在输入拼音,高亮状态
-(void)textFileChange:(
NSNotification
*)notification{UITextField*textField=notification.object;if(textField.tag
Justdoit
·
2020-03-06 06:06
iOS - 关于 KVO 的一些总结
KVO和
NSNotification
都是iOS中观察者模式的一种实现。KVO可以监听单个属性的变
师大小海腾
·
2020-03-05 21:13
iOS
ios
objective-c
xcode
UITextView 光标定位定位
UITextView根据需求实现UITextField的placeholder效果,我通过添加默认提示文字并修改文字的颜色,监听键盘弹出时,修改光标定位-(void)keyBordWillShow:(
NSNotification
奶茶007
·
2020-03-05 18:04
iOS 通知
[A]通知是什么:通知(
NSNotification
)是iOS的一种设计模式,观察者Observer模式。[B]通知的作用:可以在一个应用中的多个对象之间进行通信传递数据。
YH的练手记
·
2020-03-05 18:01
iOS 关于
NSNotification
的一些总结
本文参考苹果文档NotificationProgrammingTopics苹果文档NSNotificationCenteriOSNSNotification详解本文目录概述1.
NSNotification
1.1
拧发条鸟xds
·
2020-03-03 18:59
KVO,
NSNotification
,delegate及block区别
KVO,
NSNotification
,delegate及block区别KVO就是cocoa框架实现的观察者模式,是一对多的关系,一个值的变化会通知所有的观察者。
搬运工开发者
·
2020-03-03 09:06
多线程 子线程为什么不能更新UI
www.zhihu.com/question/22751387/answer/23754690http://blog.sina.com.cn/s/blog_45e2b66c0102v254.html今天发现一个奇怪问题,当用
NSNotification
胖渣大橘子
·
2020-02-29 14:52
Delegate/Block/
NSNotification
与多线程
Delegate/Block/
NSNotification
是最常用的事件同步方法,各自特点、区别、使用方法就不赘述了。
无边小猪
·
2020-02-27 10:18
iOS
NSNotification
传递带参数的通知
普通的通知使用注册观察者[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(getNotificationAction)name:@"ThisIsANoticafication"object:nil];发送通知[[NSNotificationCenterdefaultCenter]postNotificati
JerryLMJ
·
2020-02-26 05:05
Swift3.0 - 键盘相关
NotificationCenter.default.addObserver(self,selector:#selector(keyBoardWillShow(notification:)),name:
NSNotification
.Name.UIKeyboardWillShow
酷走天涯
·
2020-02-25 21:26
NSNotification
和NSNotificationCenter
以下内容基本上基于苹果官方文档,可能会有些许地方翻译不准确,欢迎指正!个人实验代码在这里一、需求(为什么要通知)对于通知,苹果官方文档这样说:Thestandardwaytopassinformationbetweenobjectsismessagepassing—oneobjectinvokesthemethodofanotherobject.However,messagepassingrequ
大鹏鸟
·
2020-02-25 16:30
通知
专门负责协调不同对象之间的消息通信任何一个对象都可以向通知中心发布通知,描述自己在做什么,其他感兴趣的对象可以申请在某个特定通知发布时(或者某个特定的对象发布通知时)收到这个通知特点:无障碍跨界面发布通知通知:
NSNotification
隔壁的百万富翁
·
2020-02-25 07:27
获取第三方键盘高度(包括自带键盘高度)
#pragma键盘事件-(void)keyboardWillShown:(
NSNotification
*)notif{NSDictionary*info=[notifuserInfo];NSValue*
飘金
·
2020-02-24 23:34
MVC设计模式:2-通知(
NSNotification
)
通知(
NSNotification
)同协议(Protocol)一样,也是一种在不同对象之间进行通信的机制,与协议相比,通知机制可以支持一对多的通信。
雨夜的泪
·
2020-02-23 17:05
swift3.0 中
NSNotification
的使用
swift3.0有很大变化,其中之一就是
NSNotification
使用跟原来不一样,以前NSNotificationname是String;3.0中定义了一个类型
NSNotification
.name
IBegins
·
2020-02-23 08:39
NSNotification
,KVC,KVO以及Delegate
1、KVC,即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制来间接访问对象的属性。而不是通过调用Setter、Getter方法访问。KVO就是基于KVC实现的关键技术之一。Demo:==============================@interfacemyPerson:NSObject{NSString*_name;int_age;int_height;
Ko_Neko
·
2020-02-23 05:27
swift 通知的使用
通知的使用//通知名称常量letNotifyChatMsgRecv=
NSNotification
.Name(rawValue:"notifyChatMsgRecv")//发送通知NotificationCenter.default.post
清风沐沐
·
2020-02-20 22:58
UI基础12
通知机制通知中心(NSNotificationCenter)每一个应用程序都有一个通知中心(NSNotificationCenter)实例,专门负责协助不同对象之间的消息通信任何一个对象都可以向通知中心发布通知(
NSNotification
SoManyDumb
·
2020-02-20 21:23
iOS 中KVC、KVO、
NSNotification
、delegate 总结及区别
1、KVC,即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制来间接访问对象的属性。而不是通过调用Setter、Getter方法访问。KVO就是基于KVC实现的关键技术之一。Demo:@interfacemyPerson:NSObject{NSString*_name;int_age;int_height;int_weight;}@end@interfacetest
一直在努力hard
·
2020-02-20 07:34
Delegate、
NSNotification
、KVO该如何选择?
Delegate:1.Delegate本质是一种程序设计模型,iOS中使用Delegate主要用于两个页面之间的数据传递。iphone中常用@protocol和delegate的机制来实现接口的功能。例如想在A的功能要在B中实现,可以在A中定义一个Protocol。2.delegate方法往往需要关注返回值,也就是delegate方法的结果。比如-windowShouldClose:,需要关心返回
WorldPeace_hp
·
2020-02-20 06:58
ios 常见的几种逆向传值方式
在iOS开发中,常见的几种逆向传值方式,有代理(delegate)、通知(
NSNotification
),block等等,其实还有一种方法。1、委托代理delegate只能是一对一之间的。
静心_安神
·
2020-02-19 21:32
集成极光推送、静态库、动态库
推送通知和
NSNotification
有区别
NSNotification
是抽象的,不可见的推送通知是能用眼睛看到的两种推送通知本地通知(LocalNotification):手机应用本身的通知,比如:闹钟
CoderZb
·
2020-02-18 05:44
推送通知(Local Remote)
NSNotification
是抽象的,不可见的推送通知是可见的(肉眼可见的)本地推送通知(LocalNotification)远程推送通知(RemoteNotification)可以让不再前台运行的app
董立权
·
2020-02-17 06:31
Objective-C的页面传值
页面传值的方法有很多,也很常用到,Delegate/
NSNotification
/Block/NSUserDefault/单例,等等。
康双全
·
2020-02-16 13:22
iOS 中KVC、KVO、
NSNotification
、delegate 总结及区别
1、KVC,即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制来间接访问对象的属性。而不是通过调用Setter、Getter方法访问。KVO就是基于KVC实现的关键技术之一。Demo:@interfacemyPerson:NSObject{NSString*_name;int_age;int_height;int_weight;}@end@interfacetest
Helen_kay
·
2020-02-15 12:46
iOS中的通知(
NSNotification
)
每一个应用程序都有一个通知中心NSNotificationCenter实例,专门负责协助不同对象之间的消息通信.任何一个对象都可以向通知中心发布
NSNotification
,描述自己在做什么,而任何注册了该通知的对象该特定通知发布的时候会收到这个通知
丶逐渐
·
2020-02-15 03:55
iOS 中KVC、KVO、
NSNotification
、delegate 总结及区别
1、KVC,即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制来间接访问对象的属性。而不是通过调用Setter、Getter方法访问。KVO就是基于KVC实现的关键技术之一。Demo:@interfacemyPerson:NSObject{NSString*_name;int_age;int_height;int_weight;}@end@interfacetest
毛毛家的大熊
·
2020-02-14 13:23
iOS 中KVC、KVO、
NSNotification
、delegate 总结及区别
1、KVC,即是指NSKeyValueCoding,一个非正式的Protocol,提供一种机制来间接访问对象的属性。而不是通过调用Setter、Getter方法访问。KVO就是基于KVC实现的关键技术之一。Demo:@interfacemyPerson:NSObject{NSString*_name;int_age;int_height;int_weight;}@end@interfacetest
Skipper_1_422
·
2020-02-13 20:24
学习笔记-通知
关于通知1.消息源创建通知
NSNotification
*notifiction=[NSNotificationnotificationWithName:@"tongzhi"object:niluserInfo
听雨花春风
·
2020-02-10 20:27
通知,Block,代理
NSDictionary*dict=[[NSDictionaryalloc]initWithObjectsAndKeys:@(self.currentRow),@"cellRow",nil];//创建通知
NSNotification
_wxx
·
2020-02-10 20:50
ios 键盘
NSNotificationCenter监听UIKeyboardDidShowNotification(键盘显示)UIKeyboardWillHideNotification(键盘消失)监听到这个动作的时候,调用的方法会有一个
NSNotification
AlexLi_
·
2020-02-10 15:20
NSNotification
引起的内存泄漏和循环引用
在上一篇《OC循环引用》的文章中,介绍了
NSNotification
会导致循环引用,我们先来看一下那个例子。
起个名字想破头
·
2020-02-10 04:47
深入理解iOS
NSNotification
NSNotification
在平时开发中使用非常频繁。网上关于
NSNotification
介绍大多是停留在用法的介绍,基本上没有深入介绍
NSNotification
原理的文章。故有此文!
纸简书生
·
2020-02-09 05:42
关于协议(protocol)、代理(delegate)、block、通知(
NSNotification
)、KVO
协议和代理:①协议是一个方法列表,并且里面的方法多少是相关的②协议中声明的方法默认是必须实现的,@required当然还有选择实现的@optional③协议通常和代理(delegate)搭配使用,即协议声明需要实现的代理方法,代理去实现协议声明的方法④代理是一对一的回调机制,代理对象实现协议对象,并且需要建立代理关系才能进行通信协议在发出代理请求的类的.h文件中声明(有A类和B类两个类,A想让B帮
wenny_Liu
·
2020-02-09 05:27
iOS系统的底层通知框架库
iOS系统提供了多种对观察者模式的实现:在CocoaTouch层通过
NSNotification
类和NSNotificationCent
欧阳大哥2013
·
2020-02-09 02:13
Delegation ,Block,
NSNotification
1.delegation:Delegation是一种很清晰回调形式,从Protocol的建立,到之后的引用,和对于delegate声明的变量处理,都非常具有条理。建立完Delegation之后,其他方法在调用的时候会很清晰整个回调的流程和处理。在处理一些延迟回调或者触发回掉的时候,声明调用的类里面的回调方法在编写时可以按照很独立的逻辑在制作。在使用Delegation的时候,一个回调方法可以对应多
BlueSky520
·
2020-02-08 16:07
仿
NSNotification
&NSNotificationCenter做一个通知
为了更好的理解通知,仿写了一个通知。其中用字典存储观察者,key是通知的名字,value是若干个观察者。这些观察者放到一个数组里。也就是value是数组。YBNotification@interfaceYBNotification:NSObject@property(nonatomic,copy)NSString*name;@property(nonatomic,strong,readonly)i
charlotte2018
·
2020-02-07 16:48
iOS开发遇到的奇葩事
得到崩溃的调用栈如下:可以看出,系统发出了一个通知,
NSNotification
,然后Runloop往Observer发送回调,然后UITextSelectionView执行textSelect
Abson在简书
·
2020-02-07 10:32
iOS开发--本地通知与远程通知
这里是指推送通知跟
NSNotification
有区别:1、
NSNotification
是系统内部发出通知,一般用于内部事件的监听,或者状态的改变等等,是不可见的2、本地通知与远程通知是可见的,主要用于告知用户或者发送一些
雷潮
·
2020-02-05 03:19
NSNotification
是同步操作
也就是说这个过程默认是同步的;当发送通知时,通知中心会一直等待所有的observer都收到并且处理了通知才会返回到poster;若要改为异步:方法1:-(void)actionNotification:(
NSNotification
雪小喵Yuki酱
·
2020-02-02 00:00
上一页
3
4
5
6
7
8
9
10
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他