迁移自开源中国
// 定义结构体
struct NoteGroup {
CGRect rect;
int page;
};
typedef struct NoteGroup NoteGroup;
// 存入集合
NoteGroup noteGroup = {rect, 3};
[array addObject:[NSValue valueWithBytes:¬eGroup objCType:@encode(NoteGroup)]];
// 取出
NoteGroup noteGroup;
NSValue *noteGroupValue = array[index];
[noteGroupValue getValue:¬eGroup];