1. 程式人生 > >Objective-C - NSInteger轉換NSString

Objective-C - NSInteger轉換NSString

cast you 字符 instr pen compile ber 技術 exclusive

NSInteger不是對象, 轉換為long匹配64位系統, 再組成字符串(%ld).

NSString *inStr = [NSString stringWithFormat: @"%ld", (long)month];

Note that on 64-bit processors, such as the new A7 chip, if your app is compiled for 64-bit, an NSInteger is actually a long, not an int. Doing the cast, (int)month would be destructive on 64-bit platforms for the generic case. If targeting Apple platforms exclusively, something similar that will work with both int and long – e.g. long.


技術分享

‘).text(i)); }; $numbering.fadeIn(1700); }); });

Objective-C - NSInteger轉換NSString