tags:

views:

56

answers:

0

hello, i am trying to make a button that will solve my equation. This button should automatically find the answer of the textfield that is blank. Right now i have to manually click on the done button on the keypad in order to find the missing unknown. i am using this code

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    if (textField == v) {
        [v resignFirstResponder];

        float uu = ([u.text floatValue]);
        float ss = ([s.text floatValue ]);
        float aa = ([a.text floatValue ]);


        float x1float = sqrt((uu * uu) +(2*aa*ss));


        v.text = [[NSString alloc]initWithFormat:@"%f", x1float];
    }

i saw that if i made an IBAction this missing value would be calculated however if i do make an ibaction i am unsure of how to use the bool textFieldShouldReturn method? thanks