This tutorial from Nitrex88 was awesome... You know that feeling when you've been searching all day on how to do something and then you find something that explains exactly what u were trying to do? Awesome, right? Well that's what it was like when I find this one. I'm fairly new to developing for mac OS and iphone (only 2 months in) so this was great.
I do have one question that maybe somebody can help me with.
In Nitrex's tut, he was using text fields to enter float values and then perform a calculation between them.
For what I am using this for, I changed the float values to integer values. What should I do if I don't want a certain value to exceed a number. For ex. if the user enters a number greater than 4 into one of the text fields, that text fields integer value would be equal to 4? This is what I tried:
Code:
if([aTextField.text intValue] > 4){
aTextField.text = 4;
}
I put this code right before the line of code that performs the calculation but it didn't work. It actually compiles but when a number greater than 4 is entered in "aTextField", my app freezes.
Also, how do i perform rounds. If the result of my calculation needs to be rounded up or rounded down, how can I do that? Do I need to change my float values back to integer values and then perform some code, right?
Any help would be greatly appreciated