这很刺激...... !!!uialertview不止一次致电
我GOOGLE了这个问题,发现了一些Relative Questions
但不Satisfactory Answers
。
所以我有一个- (IBAction)
方法,增加了一些UITextField's
值来NSMutableArray
时"Add"
按钮被点击。我只是试图显示UIAlertView
,如果UITextField是空。
我的代码:
- (IBAction)addButtonPressed:(id)sender
{
if ([textField1.text length]==0 || [textField2.text length]==0 || !someFlag)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:@"Please Enter Valid Data..." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[alert release];
}
else
{
// Code to add textField's value to Array.
}
}
我的问题:
每当我按“添加” 按钮与空文本框,UIAlertView
出现三次。
1)首次出现与"Close"
按钮。 (我从来没有添加...)它在一段时间内消失。
2)第二次这似乎与“OK” 按钮。 (这就是我添加的...)当我按下“OK”按钮时,它消失。
3)第三次它与一起出现“关闭”再次按钮。当我按“关闭”按钮时它消失。
编辑:
类似的问题:UIAlertView Pops Up Three Times per Call Instead of Just Once。 有人可以帮我找到解决办法吗?
问题是与其他代码不是这个代码。检查其他代码。 –
你可以显示与“关闭”按钮 –
出现的alertView你有条件[textField.text isEqualToString:@“”] – KDeogharkar