NSValue的用法
来源:互联网 发布:p图 淘宝刷手 编辑:程序博客网 时间:2024/05/20 00:36
NSValue可以包装任意值,并且NSValue可以放在NSArray和NSDicionary中
+ (NSValue *)valueWithBytes:(constvoid *)value objCType:(const char *)type;
将值放入NSValue
+ (NSValue *)value:(constvoid *)value withObjCType:(const char *)type;
将值从NSValue中取出sample code:
NSRect rect=NSMakeRect(12,21, 40, 40);
NSValue *value=[NSValue valueWithBytes:&rectobjCType:@encode(NSRect)];
NSMutableArray *arr=[NSMutableArrayarrayWithObjects:value, nil];
NSLog(@"the arr is %@",arr);
value=[arrobjectAtIndex:0];
NSLog(@"the value is %@",value);
[valuegetValue:&rect];
结果:
2013-11-15 11:39:38.311 elementFirst[538:303] the arr is (
"NSRect: {{12, 21}, {40, 40}}"
)
2013-11-15 11:39:38.313 elementFirst[538:303] the value is NSRect: {{12, 21}, {40, 40}}
- NSValue的用法
- 【黑马程序员】NSvalue的用法
- NSValue用法
- NSValue用法
- NSValue用法
- NSValue用法总结
- NSString+NSMutableString+NSValue+NSAraay用法汇总(很不错的哦)
- NSString+NSMutableString+NSValue+NSAraay用法汇总(很不错的哦)
- NSString+NSMutableString+NSValue+NSAraay用法汇总(很不错的哦)
- NSString+NSMutableString+NSValue+NSAraay用法汇总(很不错的哦)
- iOS中NSNumber和NSValue的简单用法
- NSString,NSMutableString,NSValue,NSArray 用法
- NSValue的详解
- 129,NSValue的应用
- NSValue的使用
- NSValue的详解
- NSValue的使用
- NSValue
- IOS开发之——制作运行在越狱机器上的IPA包
- unicode的理解,
- java线程同步之死锁
- 接口性能测试--JMeter
- SQL Server更新脚本模板,多谢CRM组
- NSValue的用法
- AndroidSource编译
- 电脑双屏改单屏后看不到文件问题的解决
- CCObject.h
- selenium中配置FirefoxProfile控制文件下载路径、SSL和Proxy
- Codeforces Round #212 (Div. 2) A A. Two Semiknights Meet
- c/c++指针的引用
- CenOS Linux下nginx的安装和配置
- 关于winodows下编程c++遇到的引用文件路径问题