// NSValue能够将c类型转换为Objective-C对象,如NSRange,CGPoint。CGSize,CGRect,CGVector,UIEdgeInsets,UIOffset
NSRange range = NSMakeRange(0, 1);
NSValue *rangeValue = [NSValue valueWithRange:range];
// NSValue转换NSRange
NSRange valueToRange = [rangeValue rangeValue];
// 自己定义的结构体
typedef struct {char *name; float score;} Student;
Student studentA = {"xiao ming", 85.0};
NSValue *studentValue = [NSValue value:&studentA withObjCType:@encode(Student)];
// NSValue转换Student

Student valueToStudent ;
[studentValue getValue:&valueToStudent];