V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hussion
V2EX  ›  iPhone

ARC下,NSNumber 转换 int 、 float

  •  
  •   hussion · 2014-01-02 15:36:12 +08:00 · 5113 次点击
    这是一个创建于 3781 天前的主题,其中的信息可能已经有所发展或是发生改变。
    在ARC下,为什么NSNumber不允许和int 、 float进行转换?

    编程环境为:ios7的sdk + xcode5
    laihj
        1
    laihj  
       2014-01-02 15:54:36 +08:00
    可以转啊,你怎么转的,转出什么问题了
    wezzard
        2
    wezzard  
       2014-01-02 15:56:03 +08:00
    楼主上代码吧
    icyalala
        3
    icyalala  
       2014-01-03 01:36:56 +08:00
    Show me the code
    wity_lv
        4
    wity_lv  
       2014-01-03 13:58:22 +08:00
    没道理吧··
    NSNumber *number = [NSNumber numberWithInt:1];
    int val = [number integerValue];
    NSLog(@"%@%d", number, val);
    chisj
        5
    chisj  
       2014-01-03 14:07:27 +08:00
    怎么可能!代码拿来看看!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4088 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 05:21 · PVG 13:21 · LAX 22:21 · JFK 01:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.