Question

UITextField *textField;
NSInteger intRollNumber;

Je veux prendre rollNumber comme entrée de la textField et stocker la valeur dans intRollNumber.

Comment je fais ça? Parce que je suis incapable de convertir la chaîne en entier.

Était-ce utile?

La solution

Comme cela?

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

Autres conseils

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top