#import @class Author;@interface Books : NSObject{ @private NSString *color; int book_id; NSString *box; Author *author; NSArray *r...
分类:
移动开发 时间:
2014-08-17 03:48:31
阅读次数:
226
#import @interface UserContext : NSObject @property (nonatomic,copy) NSString *name;@property (nonatomic,copy) NSString *emial;+(id) shareUsercontext;...
分类:
移动开发 时间:
2014-08-16 19:42:00
阅读次数:
198
@interface Person : NSObject//retian : release 旧值,retain 新值@property(nonatomic,retain) Book *book;//copy:release旧值,copy 新值@property(nonatomic,retain) ...
分类:
其他好文 时间:
2014-08-16 16:20:50
阅读次数:
206
OC内存管理
一、基本原理
(一)为什么要进行内存管理。
由于移动设备的内存极其有限,所以每个APP所占的内存也是有限制的,当app所占用的内存较多时,系统就会发出内存警告,这时需要回收一些不需要再继续使用的内存空间,比如回收一些不再使用的对象和变量等。
管理范围:任何继承NSObject的对象,对其他的基本数据类型无效。
本质原因是因为对象和其他数据类型在系统中的存储空间不一样,其它局...
分类:
其他好文 时间:
2014-08-16 13:54:00
阅读次数:
230
OC中类方法中只为我们提供了一些降序方法,现在我们自己定义方法,实现升序.
1.要求:定义一个Person类,实例变量包括name,age,height,定义几个对象,把这些对象保存在数组中,自己定义方法,实现数组按name,age,gheight的升序排列输出.
首先Person.h文件
#import
@interface Person : NSObject{
NSS...
分类:
其他好文 时间:
2014-08-15 00:04:06
阅读次数:
251
最终效果图:
核心代码:
NSObject+Dict.h
//
// NSObject+Dict.h
// 帅哥_团购
//
// Created by beyond on 14-8-14.
// Copyright (c) 2014年 com.beyond. All rights reserved.
// 使用运行时,将dict转成对象
#import
...
分类:
移动开发 时间:
2014-08-14 23:56:06
阅读次数:
420
内存管理任何继承了NSObject的对象,都需要进行垃圾回收,对基本数据类型无效(int float double 指针等) 原理每个对象内部都保存了一个与之相关联的整数,称为引用计数器,当使用alloc、new或者copy创建一个对象时,对象的引用计数器被设置为1给对象发送一条retain...
分类:
其他好文 时间:
2014-08-14 16:29:58
阅读次数:
193
10,文件委托,以便操作文件。头部看起来像是这样。@interface MyFileManager : NSObject@property(strong)NSFileManager *fileManager;@end.m文件#import "MyFileManager.h"@implementati...
分类:
其他好文 时间:
2014-08-12 16:17:34
阅读次数:
250
KVC简介KVC(KeyValueCoding)也就是所谓的键/值编码,键/值编码中的基本调用是-ValueForKye:和-setValue:forKey:。例子:定义个Student类,Student.h头文件如下:#import<Foundation/Foundation.h>
//学生类
@interfaceStudent:NSObject
{
NSString*name;
intage;
}
@end..
分类:
其他好文 时间:
2014-08-12 10:31:34
阅读次数:
233
利用block完成回调,小demo一个。闲话少说,直接看代码吧!O(∩_∩)O哈哈~
TestObject.h
#import
typedef void (^FinishBlock)(NSString *backStr);
@interface TestObject : NSObject
//能进行回调的方法
- (void)playSomeTime:(FinishBloc...
分类:
其他好文 时间:
2014-08-11 21:33:02
阅读次数:
241