开发者

Read Console Input As NSNumber?

Is there a way using the command line console to read a user typed value as an NSNumber, or do I have to read the input a开发者_如何学编程s a c-type integer and convert to a NSNumber object?

(e.g.)

NSLog(@"Enter Age:");
scanf("%d", &userAge);

gary


NSNumber is actually a class, not a primitive. (Unlike, say, NSInteger which is just a typedef'ed integer or long, depending on which machine you're running.)

I think you're going to have to read it in and then do [NSNumber numberWith...]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜