2
UITextField *textField;
NSInteger intRollNumber;

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

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

Sushil Sharma
  • 2,321
  • 3
  • 29
  • 49
SST
  • 2,040
  • 5
  • 26
  • 42

2 Answers2

14

Like this?

NSString *str = [textField text]
int RollNumber = [str intValue];
Andriy M
  • 76,112
  • 17
  • 94
  • 154
dermdaly
  • 529
  • 4
  • 14
2

See the text property and integerValue.

Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539