V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
hussion
V2EX  ›  iPhone

ARC下,NSNumber 转换 int 、 float

  •  
  •   hussion · Jan 2, 2014 · 12974 views
    This topic created in 4504 days ago, the information mentioned may be changed or developed.
    在ARC下,为什么NSNumber不允许和int 、 float进行转换?

    编程环境为:ios7的sdk + xcode5
    laihj
        1
    laihj  
       Jan 2, 2014
    可以转啊,你怎么转的,转出什么问题了
    wezzard
        2
    wezzard  
       Jan 2, 2014
    楼主上代码吧
    icyalala
        3
    icyalala  
       Jan 3, 2014
    Show me the code
    wity_lv
        4
    wity_lv  
       Jan 3, 2014
    没道理吧··
    NSNumber *number = [NSNumber numberWithInt:1];
    int val = [number integerValue];
    NSLog(@"%@%d", number, val);
    chisj
        5
    chisj  
       Jan 3, 2014
    怎么可能!代码拿来看看!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   969 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 23:40 · PVG 07:40 · LAX 16:40 · JFK 19:40
    ♥ Do have faith in what you're doing.