Objective-C语法之KVC的使用除了一般的赋值和取值的方法,我们还可以用Key-Value-Coding(KVC)键值编码来访问你要存取的类的属性。下图来自苹果官网:如何使用KVC存取对象属性呢?看个示例1、使用KVC定义一个Student类,继承于NSObject。.h文件#import ...
分类:
其他好文 时间:
2014-10-10 23:32:44
阅读次数:
274
-(id)performSelector:(SEL)aSelector withObject:(id)anObjectDescription[说明]Sends a message to the receiver with an object as the argument. (required)[将...
分类:
其他好文 时间:
2014-10-10 16:28:10
阅读次数:
146
-(id)performSelector:(SEL)aSelector withObject:(id)anObject withObject:(id)anotherObjectDescription[说明]Sends a message to the receiver with two object...
分类:
其他好文 时间:
2014-10-10 16:00:50
阅读次数:
223
-(id)performSelector:(SEL)aSelectorDescription[说明]Sends a specified message to the receiver and returns the result of the message. (required)[发送指定消息的接...
分类:
其他好文 时间:
2014-10-10 13:29:34
阅读次数:
288
更改协议成block,运行,设置一个头文件person.h#import @interface Person : NSObject@property (nonatomic, copy) void (^brak)(void); //声明void类返回void的block类型的brak,@propert...
分类:
其他好文 时间:
2014-10-09 23:34:48
阅读次数:
194
1首先创建一个模型类,一定要遵守NSCoding协意。@interface Contact : NSObject @property (nonatomic, copy) NSString *name;@property (nonatomic, copy) NSString *phone;@endim...
分类:
其他好文 时间:
2014-10-09 22:49:51
阅读次数:
240
Block语法是在iOS4.0的SDK 中开始新增的, 在那时就已经有了超过400多个API使用了Block语法.Block对象又同样是继承与NSObject, 是C语言级别的语法和运行时特性. 和标准的C函数指针类似. 但其除了可执行语句外, 还可以类似对象可以保持状态数据.和C语言的函数指针类似...
分类:
编程语言 时间:
2014-10-09 20:29:37
阅读次数:
213
#import
#import "ASIFormDataRequest.h"
#import "Reachability.h"
@protocol NetWorkDelegate;
@interface JSNetWord : NSObject
+(id)ShareNetwork;
-(void)NetWorkWithConnctId:(int)connectid body:(NSString *)bod...
分类:
移动开发 时间:
2014-10-09 19:27:57
阅读次数:
240
代码:@interface HttpProcessor : NSObject { NSMutableData *buffer;}@property BOOL finished;@property (strong, nonatomic) NSString *html;@end@implement...
分类:
其他好文 时间:
2014-10-09 02:00:57
阅读次数:
141
接口文件1:Animal.h#import #import "Cat.h"@interface Animal : NSObject{// NSString *_color;// NSString *_name; Cat *_cat;}@property (nonatomic,assign,readw...
分类:
其他好文 时间:
2014-10-06 22:39:30
阅读次数:
194