tags:

views:

86

answers:

0

Hi

Why is my it skipping the first statement and only displaying the kg message (else statement) regardless of what my switch is set to? Should I be using a function other than toggleSwitchWeight?

Thanks so much for your help guys! :D

-(IBAction) WswitchValueChanged{
    if (toggleSwitchWeight.on)
    {
        weightpounds =  [weight.text intValue]; //converts string in textfield to integer and assigns to variable weightpounds
        weightkg = 1;
        Output.text = [NSString stringWithFormat:@"%ld pounds", (long)weightpounds];
    }
    else
    {

        weightkg =  [weight.text intValue]; //converts string in textfield to integer and assigns to variable weightkg
        weightpounds = 1;
        Output.text = [NSString stringWithFormat:@"%ld kg", (long)weightkg];
    }
}