开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜