在 iphone 应用程序中,我使用 alertview 检查文本框值是否为空,然后它应该显示警报,否则移动到下一个屏幕,但是当我再次输入值时,警报视图显示我不知道是什么问题
如果我也输入值,它总是显示是否为真
-(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];
}}