首页 > 其他 > 详细

Objective-C - NSInteger转换NSString

时间:2015-07-13 12:23:22      阅读:248      评论:0      收藏:0      [点我收藏+]

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

原文:http://blog.csdn.net/caroline_wendy/article/details/46858877

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!