通知传值
//流程:
1.注册通知
2.通知中心,发送一条消息通知----------其中name名字千万不要写错了,会出现在3个地方
3.实现通知中心内部的方法,并实现传值
4.第四步,消息发送完,要移除掉
代码如下:...
分类:
其他好文 时间:
2014-07-19 23:31:49
阅读次数:
315
使用起来很类似,参看以下网址http://stackoverflow.com/questions/10327200/equivalent-of-ios-nsnotificationcenter-in-android
分类:
移动开发 时间:
2014-07-18 18:19:42
阅读次数:
247
iOS键盘中英文切换键盘高度获取通知方法,有需要的朋友可以参考下。注册通知- (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[NSNotificationCenter defaultCente...
分类:
移动开发 时间:
2014-07-16 21:10:53
阅读次数:
189
// 网络变化消息 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(checkNetwork) name: kReachabilityChangedNotification object: nil...
分类:
Web程序 时间:
2014-07-14 21:50:23
阅读次数:
212
单例的应用十分普遍,单例模式使一个类只有一个实例。
*易于供外界访问.
*方便控制实例个数,节约系统资源.
*OC中的常见单例:
UIApplication,
NSNotificationCenter,
NSUserDefaults,NSFIleManager。
*应用程序中用到单例的:
背景音乐,音效管理等。
一、ARC中实现单例
*...
分类:
移动开发 时间:
2014-07-10 17:23:17
阅读次数:
253
m_listView:textview在tableview上,同时需要修改tableview高度//注册观察者 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboarWillShow:) na...
分类:
其他好文 时间:
2014-07-09 14:56:17
阅读次数:
185
1. 定义一个方法-(void) update{ }2. 对象注册,并关连消息[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(update) name:@"update" object:nil]3. 在...
分类:
其他好文 时间:
2014-07-07 17:45:21
阅读次数:
312
之前写过一篇《如何更好地限制一个UITextField的输入长度》,在文章最后得到的结论是可以直接使用UIKIT_EXTERN NSString *const UITextFieldTextDidChangeNotification;进行监听,截断超出maxLength的部分。所以后来我在处理UITextView的内容长度时,也直接参考这个方法:[[NSNotificationCenter def...
分类:
其他好文 时间:
2014-07-06 09:27:20
阅读次数:
385
//首先注册通知,键盘出现和消失的通知[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(keyboardAppear:) name:UIKeyboardWillShowNotification objec...
分类:
其他好文 时间:
2014-07-05 18:44:19
阅读次数:
170
1.发通知。(以这条通知为例,通知名字:gameOverNotification。通知参数:title)
NSNotificationCenter.defaultCenter().postNotificationName("gameOverNotification", object: title)
2.在要监听这则通知的viewDidload方法里面添加观察者,以便监听这则通知
...
分类:
其他好文 时间:
2014-07-01 14:28:52
阅读次数:
230