// AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;// NSArray *snsNames = [NSArray arrayWithObjects:// ...
分类:
其他好文 时间:
2015-05-07 15:58:41
阅读次数:
105
1、在父类中注册KVO 子类中KVO不相应的解决办法 在父类中通过判断发送对象的类是不是父类或者子类-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change ...
分类:
其他好文 时间:
2015-05-07 12:04:58
阅读次数:
143
接下来实现EDStarRating 的编辑。 在loadView 方法中,我们已经配置了EDStarRating的delegate属性,我们仅仅需要实现相关委托方法即可。打开MasterViewController.swift 在 EDStarRatingProtocol 扩展中添加如下方法: func starsSelectionChanged(control: EDStarRating!,...
分类:
移动开发 时间:
2015-05-07 10:31:58
阅读次数:
369
using System;using System.IO;namespace ConsoleApplication2{ delegate void D(int x); class Program { static void Main(string[...
using System;using System.IO;namespace ConsoleApplication2{ delegate int NumberChanger(int n); class Program { static int num = 10; ...
iOS 锁屏判断应用程序的单例类对象中得到应用程序委托的对象UIApplicationDelegate* myDelegate = [[UIApplication sharedApplication] delegate];UIApplication接收到所有的系统事件和生命周期事件时,都会把事件传递...
分类:
移动开发 时间:
2015-05-06 19:31:38
阅读次数:
207
KVC即key-value coding的缩写,KVO即key-value observing的缩写假如需要掌握Key-Value Observing机制,那么需要阅读本文应该有帮助。本文提供了Key-Value Observing的一个概述,并且解释为什么需要用它,什么时候用它。在阅读本文之前需要...
分类:
其他好文 时间:
2015-05-06 12:49:13
阅读次数:
103
在设计模式中,有一种模式称为观察者模式,Objective-c也提供了类似的机制,简称为KVO【Key-Value Observing】。当被观察者的属性改变时立即通知观察者触发响应的行为。 在KVO中,首先被观察者与观察者应该先建立关系,当被观察的特定属性改变时,立刻通知观察者,建立联系调用...
分类:
移动开发 时间:
2015-05-06 01:17:41
阅读次数:
362
在实际开发及应用过程中,经常会遇到通过外部数据构造的字典的键要多于自定义数据模型中属性的个数的情况。例如:从外部获得JSON格式的数据包含5个键,如下所示:{ "cityname" : "beijing", "state1" : "0", "state2" : "1", "t...
分类:
其他好文 时间:
2015-05-05 23:15:51
阅读次数:
127
1. ThreadStart表示执行线程的方法
ThreadStart(delegate(){})
public static void testThread()
{
int Max_Thread_Count = 10;
long currentThreadCount = 0;
for(v...
分类:
编程语言 时间:
2015-05-05 16:33:36
阅读次数:
283