随笔分类 - Objective-C
摘要:- (NSMutableArray *)zuHeSuanFa:(NSMutableArray *)array chooseCount:(int)m { int n = (int)[array count]; if (m > n) { return nil; } // NSLog(@"从1到%d中取%d个数的组合。。。",n...
阅读全文
摘要:本文转自:http://blog.csdn.net/yuquan0821/article/details/6646400/ 一,概述 KVO,即:Key-Value Observing,它提供一种机制,当指定的对象的属性被修改后,则对象就会接受到通知。简单的说就是每次指定的被观察的对象的属性被修改后
阅读全文
摘要:自定义的对象的解档和归档 如果想对自己自定义的类进行解档和归档的话 必须遵循一个协议:NSCoding Student.h 文件 Student.m 文件 客户端代码 运行结果:
阅读全文
摘要:协议 协议只有方法的声明(类似于其他编程语言的接口) 协议相当于大家都所遵循的 关键字 @protocol 协议名 <所遵循的协议> 默认NSObject @end @protocollamcoProtocol <NSObject>@required //必须实现的方法 -(void)study;@
阅读全文
摘要:#import #import "Car.h"int main(int argc, const char * argv[]) { @autoreleasepool { Car *ca =[Car new]; Engine *eng=[Engine ne...
阅读全文
摘要:int main(int argc, const char * argv[]) { @autoreleasepool { //字符串进行排序 NSArray *arr=@[@"b",@"a",@"c"]; NSSortDescriptor *ns=[NSSortDescriptor sortDesc
阅读全文
摘要:NSDate#import int main(int argc, const char * argv[]) { @autoreleasepool { //通过date方法创建的时间对象,对象就保存了当前的时间; /* NSDate *now=[NSDate date]...
阅读全文
摘要:#import int main(int argc, const char * argv[]) { @autoreleasepool {// NSDictionary *dic=[NSDictionary dictionaryWithObject:@"lnj" forKey:@"...
阅读全文
摘要:1.数字int main(int argc, const char * argv[]) { @autoreleasepool { //添加空白 [NSNull null]// NSArray *arr=[NSArray arrayWithObjects:@1,@2,...
阅读全文
摘要:#import int main(int argc, const char * argv[]) { @autoreleasepool { /** * NSArray 数组,可以存储任何类型的OC对象 NSEnumerator, N...
阅读全文
摘要:#import int main(int argc, const char * argv[]) { @autoreleasepool { /** * length获取字符串长度,即获取字符个数 */// NSString *str=...
阅读全文
摘要:下载地址:http://pan.baidu.com/s/1boxvewB1.首先下载解压压缩包打开VVDocumenter工程,编译一遍(快捷键com+B)2.在finder里面的应用程序,找到Xcode,右键 “显示包内容”,在Contents文件夹下,找到Info.plist文件,并打开,找到D...
阅读全文
摘要:在OC中结构体有时候也作为对象的属性类的定义#import typedef struct{ int year; int month; int day;} Date;@interface Student : NSObject{ @public NSString *_nam...
阅读全文
摘要:今天终于开始进行OC的学习了一.首先讲了NSLogNSLog是oc里面的输出语句,其用法和printf差不多,但是还是有差别的1,NSLog是自动换行的,不用像printf那样还需要加'\n';2,NSLog在引号面前需要添加@符号,例如: NSLog(@"Hello World"); ...
阅读全文

浙公网安备 33010602011771号