码迷,mamicode.com
首页 >  
搜索关键字:nsnotificationcenter    ( 284个结果
通知与线程
代码:@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; /// 添加通知中心观察者 [[NSNotificationCenter defaultCenter] addObserver:s...
分类:编程语言   时间:2015-06-18 21:29:12    阅读次数:132
iOS 通知 NSNotification
注册通知             [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(TongZhiJianTingFangFa:) name:@"TongZhi_Type" object:nil];   通知监听的方法 #pragma mark (通知处理)接收通知更改频道名称 - (void...
分类:移动开发   时间:2015-06-16 16:47:29    阅读次数:121
ios的notification机制是同步的还是异步的
与javascript中的事件机制不同,ios里的事件广播机制是同步的,默认情况下,广播一个通知,会阻塞后面的代码: Objc代码   -(void) clicked   {       NSNotificationCenter *center =  [NSNotificationCenter defaultCenter];       [center pos...
分类:移动开发   时间:2015-06-09 09:51:25    阅读次数:168
IOS笔记044-通知和代理(观察者模式和代理模式)
处理文本输入框的输入事件,单击文本输入框后要弹出键盘。弹出键盘有两种实现方式:一种代理,一种通知。也就是对应的(观察者模式和代理模式)。1、通知 1.1、准备工作 每一个应用程序都有一个通知中心(NSNotificationCenter)实例,专门负责协助不同对象之间的消息通信。 任何...
分类:移动开发   时间:2015-06-08 16:40:22    阅读次数:195
iOS通知的使用
注册:[[NSNotificationCenter defaultCenter] postNotificationName:@"changeColor" object:self];接收处观察 : [[NSNotificationCenter defaultCenter] addObserver:se...
分类:移动开发   时间:2015-06-07 18:46:31    阅读次数:139
iOS NSNotificationCenter(消息机制)
转自:http://blog.csdn.net/liliangchw/article/details/8276803对象之间进行通信最基本的方式就是消息传递,在Cocoa中提供Notification Center机制来完成这一任务。其主要作用就是负责在任意两个对象之间进行通信。使用方法很简单,如下...
分类:移动开发   时间:2015-06-06 23:17:39    阅读次数:217
UITextView 与 keyboard 处理
通过向 NSNotificationCenter 注册观察者监听键盘事件,根据键盘状态,从而动态调整 UITextView的 edgeInsets #import?"ViewController.h" @interface?ViewController?() @property?(nonatomic,?strong)?U...
分类:其他好文   时间:2015-06-01 11:47:34    阅读次数:198
使用Reachability监测网络变化-陈鹏
在appdelegate里面添加观察者,并启动监测 // 使用通知中心监听kReachabilityChangedNotification通知 [[NSNotificationCenter defaultCenter] addObserver:self ...
分类:其他好文   时间:2015-05-29 17:48:52    阅读次数:148
IOS 传值方法总结
1、属性传值前向后传值。2、协议传值3、Block传值代替协议代理传值,主要时间点问题。4、单利传值数据共享。5、通知传值通知中心NSNotificationCenter提供了一种更加解耦的方式。最典型的应用就是任何对象对可以发送通知到中心,同时任何对象可以监听中心的通知。发送通知的代码如下:[[N...
分类:移动开发   时间:2015-05-29 13:34:19    阅读次数:149
ios 监听系统键盘的出现和消失
//注册键盘出现的通知     [[NSNotificationCenter defaultCenter] addObserver:self                                              selector:@selector(keyboardWasShown:)                                          ...
分类:移动开发   时间:2015-05-27 12:24:04    阅读次数:220
284条   上一页 1 ... 15 16 17 18 19 ... 29 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!