【发布时间】:2011-07-13 06:49:06
【问题描述】:
if([txtField1.text intValue] == nil && [txtField2.text intValue] == nil && [txtField3.text intValue] == nil && [txtField4.text intValue] == nil && [txtField5.text intValue] == nil && [txtField6.text intValue] == nil && [txtField7.text intValue] == nil && [txtField8.text intValue] == nil )
{
UIAlertView *info = [[UIAlertView alloc] initWithTitle:@"Info" message: @"Please complete your test." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[info show];
[info release];
}
else if(txtField1.text == NULL || txtField2.text == NULL || txtField3.text == NULL || txtField4.text == NULL || txtField5.text == NULL || txtField6.text == NULL ||txtField7.text == NULL || txtField8.text == NULL )
{
UIAlertView *info = [[UIAlertView alloc] initWithTitle:@"Info" message: @"Please complete your test." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[info show];
[info release];
}
else{
fourthScreen=[[FourthScreen alloc] initWithNibName:@"FourthScreen" bundle:nil];
[self.navigationController pushViewController:self.fourthScreen animated:YES];
}
在上面的代码中,我有 8 个文本字段。为此,我定义了一个条件,即当所有文本字段为 nil 时,显示警报视图消息。它正在工作。但是当我定义为当任何人有零或空白文本字段时,也会显示警报视图但它不显示。问题是当我输入整数值“0”时,它也会显示警报视图,但我希望它不显示“0”值。 picke4r 视图选择的值。如何设置代码?
【问题讨论】:
标签: iphone xcode uiview uitextfield uipickerview