代码改变世界

NSMutableSte 可变集合 继承Set

2015-12-20 19:36 by AB小博客, 145 阅读, 0 推荐, 收藏,
摘要://// main.m#import int main(int argc, const char * argv[]) { @autoreleasepool { //不能重复 无序 继承NSSet NSMutableSet *mset = [NSMutableSe... 阅读全文

NSSet集合 无序的 不能重复的

2015-12-15 22:40 by AB小博客, 468 阅读, 0 推荐, 收藏,
摘要://// main.m// NSSet集合//// Created by MAC on 15/12/15.// Copyright © 2015年 MAC. All rights reserved.//#import //1.不能重复//2.无序的int main(int argc, con... 阅读全文

数组 客户订单实例

2015-12-15 21:33 by AB小博客, 327 阅读, 0 推荐, 收藏,
摘要:订单类//// Order.h#import #import "Customer.h"@interface Order : NSObject@property(nonatomic)int oid;@property(nonatomic,strong)NSString *name;@property... 阅读全文

可变数组 NSMutableArray

2015-12-15 16:11 by AB小博客, 158 阅读, 0 推荐, 收藏,
摘要://// main.m// 可变数组//// Created by MAC on 15/12/15.// Copyright © 2015年 MAC. All rights reserved.//#import #import "Person.h"int main(int argc, con... 阅读全文

不可变数组NSArray

2015-12-15 15:44 by AB小博客, 172 阅读, 0 推荐, 收藏,
摘要://// main.m// OC数组//// Created by MAC on 15/12/15.// Copyright © 2015年 MAC. All rights reserved.//#import @interface Customer :NSObject@property i... 阅读全文

自动释放池

2015-12-14 13:54 by AB小博客, 132 阅读, 0 推荐, 收藏,
摘要:[p autorelease];//会把p暂时放到自动释放池子里NSAutoreleasePool 等待系统收走@autoreleasepool { 建立一个自动释放池 程序结束自动释放 ················} 阅读全文

字符串和集合的内存管理

2015-12-14 12:17 by AB小博客, 158 阅读, 0 推荐, 收藏,
摘要:1.retain 是指针拷贝 copy 是内容拷贝 2.如果想在set方法中不修改外部传递过来的字符串,则使用copy,否则使用retain //// main.m#import @interface Person : NSObject@end@implementation Person-(vo... 阅读全文

属性内存管理

2015-12-14 10:46 by AB小博客, 150 阅读, 0 推荐, 收藏,
摘要:1.assign 赋值不会引起计数的变化,弱引用,ARC中对象不能使用,但原始类型BOOL int float仍然可以使用2.copy 拷贝,复制一个对象并创建strong关联,引用计数为1(+1),原来的引用计数不变3.retain 持有,对原对象引用计数加1,强引用,ARC中使用strong4.... 阅读全文

关联对象的内存管理

2015-12-13 20:14 by AB小博客, 267 阅读, 0 推荐, 收藏,
摘要://// main.m#import #import "Pet.h"#import "Person.h"#import "SuperMan.h"int main(int argc, const char * argv[]) { @autoreleasepool { Person... 阅读全文

OC内存管理

2015-12-13 16:33 by AB小博客, 161 阅读, 0 推荐, 收藏,
摘要:alloc 分配内存dealloc 释放内存new分配内存(不常用)initcopy分配内存 (拷贝内容 非地址)retain 引用计数自动加1release 引用计数自动减1autorelease自动释放内存retainCount保留计数值//// main.m#import @interfac... 阅读全文