i need to implement two segmented controls. The result will be different considering the index of the two segmented controls. Considering that in the first one each index has an int fixed number (not variable) and the second controls has an equation associated for each index. I need that the program understands which is the combination of the two controls (e.g. I = 0 & II = 1). I develop this code but is not working for me.
if ((effortSegmented.selectedSegmentIndex ==0) && (styleSegmented.selectedSegmentIndex ==0)) {
float weight_b = [weightTf.text floatValue];
float totalCal = (((704*weight_b)/70.38) - 12);
self.calL.text=[NSString stringWithFormat:@"~%.1f kcal", totalCal];
} else if ((effortSegmented.selectedSegmentIndex==0) && (styleSegmented.selectedSegmentIndex==1)) {
float weight_b = [weightTf.text floatValue];
float totalCal = (((704*weight_b)/70.38)+32);
self.calL.text=[NSString stringWithFormat:@"~%.1f kcal", totalCal];
} else if ((effortSegmented.selectedSegmentIndex==0) && (styleSegmented.selectedSegmentIndex==2)) {
float weight_b = [weightTf.text floatValue];
float totalCal = (((704*weight_b)/70.38)+51);
self.calL.text=[NSString stringWithFormat:@"~%.1f kcal", totalCal];
}
as you can see the [-12, 32, 51] are fixed int associated with the first control index. Running the program even if i change the control index one, it would not result in any change in the label. Don't know where to look.
PS I can't declare tags because in
-(void)awakefornib {
[segControl setSegmentedCount:3]
}
i can't see the setSegmentedCount. Is not available in the list.
Thanks