Sorry guys, I'm a noob. I know that some languages support type casting, but when I tried to do that here it failed, miserably. I've got an UITextField with number only pad, so I'm only getting numbers, and I need the output from that in my int, diff. Here's what I tried:
NSString *outputNumber = [NSString stringWithFormat:@"%d", [textBox.text]];
diff = [outputNumber intValue]; //Not so much
What happens is my diff goes to some incredibly high number instead of the single digets I tested with. Any help I could get is great. Thanks :)
Why are you using [ ] around textBox.text? And you dont need temporary outputNumber string .
Try this :
diff = [textBox.text intValue];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With