user1188275 user1188275 - 23 days ago 6
iOS Question

How to display an Integer Value in UITextField?

One of My First View Controller's method returns an integer value which I want to display it in second view controllers's text field. how to set the value.because

UITetxtfield
takes only String as input.

Answer

You should save the integer in a NSString using the method:

  • (id)stringWithFormat:(NSString *)format

for example

int number = 0;

NSString *myString;

myString = [NSString stringWithFormat:@"%d", number];

Now number is saved in a NSString and you can use it on the UITextField property