码迷,mamicode.com
首页 > 其他好文 > 详细

Objective-C - NSInteger转换NSString

时间:2017-06-16 22:09:21      阅读:311      评论:0      收藏:0      [点我收藏+]

标签:script   mat   rac   for   blog   post   str   content   mod   

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.


技术分享

Objective-C - NSInteger转换NSString

标签:script   mat   rac   for   blog   post   str   content   mod   

原文地址:http://www.cnblogs.com/blfbuaa/p/7029265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!