【发布时间】:2012-05-13 17:11:03
【问题描述】:
这是目标 c 中强制转换运算符的正确用法:
//casting an int to float
int a = 1;
float b = (float) a;
为什么我不能使用以下内容将 int 转换为 nsstring:
int a = 1;
NSString *c = (NSString *)a;
//I receive the error : "cast of 'int' to 'nsstring' is disallowed with ARC"
执行上述操作在概念上有什么问题?
附:我已经知道我应该使用 "c= [NSString stringWithFormat:@"%i",a];"!
【问题讨论】:
-
只是编译器支持或提供的方式/语法。
标签: objective-c casting nsstring int