How to convert NSNumber to NSString

后端 未结 7 1296
孤城傲影
孤城傲影 2020-11-29 19:25

So I have an NSArray \"myArray\" with NSNumbers and NSStrings. I need them in another UIView so i go like this:



        
相关标签:
7条回答
  • 2020-11-29 20:00
    //An example of implementation :
    // we set the score of one player to a value
    [Game getCurrent].scorePlayer1 = [NSNumber numberWithInteger:1];
    // We copy the value in a NSNumber
    NSNumber *aNumber = [Game getCurrent].scorePlayer1;
    // Conversion of the NSNumber aNumber to a String with stringValue
    NSString *StringScorePlayer1 = [aNumber stringValue];
    
    0 讨论(0)
提交回复
热议问题