开发者

Need help with unit converter app getting uipicker to call a function

开发者 https://www.devze.com 2023-04-01 04:44 出处:网络
something is going haw ire in tis bit of code - (void)pickerView:(UIPickerView *) thePickerView didSelectRow:

something is going haw ire in tis bit of code

      - (void)pickerView:(UIPickerView *)
      thePickerView didSelectRow:
     (NSInteger)rowinComponent:(NSInteger)component {
      if ( row ==1) {

    -(IBAction)presstoconvert{

    float number1 = ([initamount.text floatValue ]);
    float answer = number1 *12;
    result.text = [[NSString alloc]initWithFormat:@"%2.f", answer];
    }
}

else ( row == 2);{
    float number1 = ([initamount.text floatValue ]);
    float answe开发者_Python百科r = number1 /12;
    result.text = [[NSString alloc]initWithFormat:@"%2.f", answer];
}

}


Why have you defined an pressToConvert inside didSelectRow:? Just remove -(IBAction)presstoconvert{ & the corresponding } & you should be good.

Otherwise, you could move pressToConvert outside this method body and call it from here.

0

精彩评论

暂无评论...
验证码 换一张
取 消