2014-02-26 35 views
-2

您好顯示值的另一種的viewController

我有StarViewController,其中用戶在不同的UITextFields

輸入數據(身高,體重)有一個按鈕稱爲計算當計算 用戶點擊我想按鈕順着接下去resultViewController

和resultViewController我有3個的UITextField

最大值,微量,實際,

這些值在這個3的UITextField

在最大值值最大值 在微量微量valeu在 實際相同的值輸入該用戶

我只需要執行此操作和按鈕的代碼該代碼在resultViewController

顯示這些值這是我的代碼:

-(void)heightMethod{ 
    double cm = _maxima.text.doubleValue; 
    if(cm >=1.50 && cm <=1.55) { 
    _maxima.text = [NSString stringWithFormat:@"61"]; 
    _minim.text =[NSString stringWithFormat:@"45"]; 
}else if(cm >=1.60 && cm<=1.65){ 
    _maxima.text = [NSString stringWithFormat:@"71"]; 
    _minim.text = [NSString stringWithFormat:@"49"]; 
}else if (cm >= 1.70 && cm <=1.75){ 
    _maxima.text = [NSString stringWithFormat:@"82"]; 
    _minim.text = [NSString stringWithFormat:@"53"]; 
}else if (cm >=1.80 && cm <=1.85){ 
    _maxima.text = [NSString stringWithFormat:@"87"]; 
    _minim.text = [NSString stringWithFormat:@"60"]; 
}else if (cm >=1.90 && cm >= 1.95){ 
    _maxima.text = [NSString stringWithFormat:@"92"]; 
    _minim.text = [NSString stringWithFormat:@"63"]; 
}else if (cm >=2.00){ 
    _maxima.text = [NSString stringWithFormat:@"100"]; 
    _minim.text = [ NSString stringWithFormat:@"71"]; 
} 


} 

-(void)actualWeightMethod{ 
double kgActual = _aktual.text.doubleValue; 
if (kgActual >=50 && kgActual <= 55) { 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
}else if (kgActual >=60 && kgActual<= 65){ 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
}else if (kgActual >=70 &&kgActual <=75){ 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
}else if (kgActual >=80 && kgActual <=85){ 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
}else if (kgActual >=90 && kgActual <=95){ 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
}else if (kgActual >=100){ 
    _aktual.text = [NSString stringWithFormat:@"equal aktual"]; 
} 


} 
- (IBAction)calculate:(id)sender { 
} 

感謝對H elp

回答

0
- (void) prepareForSegue: (UIStoryboardSegue *) segue sender: (id) sender{ 

    ResultViewController *destViewController = (ResultViewController*)segue.destinationViewController; 
    //Create 3 NSStrings in your resultViewController and set your values desired for show them as you want. 
    destViewController.max = yourValueMax; 
    destViewController.min = yourValueMin; 
    destViewController.actual = yourValueActual; 

} 
相關問題