For every object that can have a delegate, there is a corresponding protocol that declares themessages that the object can send its delegate. The dele...
分类:
其他好文 时间:
2014-12-08 19:10:18
阅读次数:
211
引子:一个小示例,希望可以帮助广大侠士们来理解delegate。在C中的函数指针示例: 1 #include 2 3 // 减法运算 4 int minus(int a, int b) { 5 return a - b; 6 ...
- (void)viewDidLoad{ [superviewDidLoad]; //建立在你已经遵守了 self.numTF.delegate =self; self.passTF.delegate=self; //密文显示 self.passTF.secureTextEntry=YES;}#p....
分类:
移动开发 时间:
2014-12-07 21:31:44
阅读次数:
192
总结下引入event的好处:
1,event封装了委托类型的变量,相当于为委托类型量身定制的属性(property)。
2,使用事件不仅能获得比委托更好地方封装性,还能限制含有事件的类型的能力。...
分类:
其他好文 时间:
2014-12-07 17:52:16
阅读次数:
189
IOS--UIAlertView的使用方法详细// UIAlertView的常用方法//标准样式UIAlertView*oneAlertView = [[UIAlertViewalloc]initWithTitle:@"标题"message:@"提示内容"delegate:selfcancelBut...
分类:
移动开发 时间:
2014-12-06 10:00:39
阅读次数:
183
在iOS8开发中,发现一个CoreLocation的使用问题,执行操作之后,不会调用到定位之后的delegate方法中。根据文档,需要在使用CoreLocation前调用方法:[locationmanager requestAlwaysAuthorization]; [location...
分类:
移动开发 时间:
2014-12-05 19:17:33
阅读次数:
196
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;u...
分类:
其他好文 时间:
2014-12-05 17:00:16
阅读次数:
156
Objective-C释解Target-Action模式Target-Action模式是ObjC里非常常见的对象之间方法调用的方式,不过ObjC把方法调用叫做Send Message.一帮情况在和UI打交道时候处理各种GUI上的事件会利用到这种模式.相对应的.NET上的处理模式就是delegate/...
分类:
其他好文 时间:
2014-12-04 21:22:45
阅读次数:
208
1.在主窗体(含有serialPort的窗体)中//先定义委托 public delegate void OpenPort(); public delegate void ClosePort();//同样在主窗体中实现添加 public void ClosePort()//关闭串口,供委托调用...
1.C#中的每一个委托都内置了BeginInvoke和EndInvoke方法,如果委托的方法列表里只有一个方法,那么这个方法就可以异步执行(不在当前线程里执行,另开辟一个线程执行)。委托的BeginInvoke和EndInvoke方法就是为了上述目的而生的。
2.原始线程发起了一个异步线程,有如下三种执行方式:
方式一:等待一直到完成,即原始线程在发起了异步线程以及做了一些必要处理之后,原始线...
分类:
编程语言 时间:
2014-12-04 18:09:21
阅读次数:
175