从UITextField检索整数值到NSInteger变量

[英]retrieving integer value from the UITextField into a NSInteger variable


UITextField *textField;
NSInteger intRollNumber;

I want to take rollNumber as input from the textField and store the value into intRollNumber .

我想将rollNumber作为textField的输入,并将值存储到intRollNumber中。

How i do that? Because I am unable to convert the string into integer.

我是怎么做到的?因为我无法将字符串转换为整数。

2 个解决方案

#1


Like this?

NSString *str = [textField text]
int RollNumber = [str intValue];

#2


See the text property and integerValue.

请参见text属性和integerValue。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2009/05/20/6f8b2f04d9006cc0e8be8749d966b641.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告