iPhoneアプリでは、alertviewを使用して、テキストボックスの値が空かどうかを確認しています。そうでない場合は、アラートが表示されます。それ以外の場合は、次の画面に移動しますが、値をもう一度入力すると、アラートビューが表示され、何が問題なのかわかりません。
私も値を入力すると、trueの場合は常に表示されます。
-(IBAction)buttonClick{
if (monthTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (motionSicknessTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (prescriptionTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (otherMeansTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (cereniaTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (costToClientTextField.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else if (clinicMarkup.text=@"") {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please enter values first" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else{
GraphsViewController*targetController=[[GraphsViewController alloc]init];
NSString*dogswithMotionSickness=motionSicknessTextField.text;
NSString*valueOne=cereniaTextField.text;
NSString*valueTwo=prescriptionTextField.text;
NSString*valueThree=otherMeansTextField.text;
NSString*valueFour=overtheCounterTextField.text;
cerenia=cereniaTextField.text;
NSString*costToClient=costToClientTextField.text;
NSString*clinicalMarkup=clinicMarkup.text;
perMonth=monthTextField.text;
targetController.perMonth=perMonth;
targetController.dogswithMotionSickness=dogswithMotionSickness;
targetController.valueOne=valueOne;
targetController.valueTwo=valueTwo;
targetController.valueThree=valueThree;
targetController.valueFour=valueFour;
targetController.cerenia=cerenia;
targetController.costToClient=costToClient;
targetController.clinicalMarkup=clinicalMarkup;
[self.navigationController pushViewController:targetController animated:YES];
}}