我想显示嵌套的alertView。我在嵌套alertViews中面临的问题是,当我单击第一个alertView的“添加”按钮时,它显示第二个alertView,在第二个alertView中我有一个文本字段和一个“保存”按钮。我想在单击保存按钮时保存数据,然后重新加载 UITableViewData,它已经在第一个alertView中。
我是 iPhone 新手,请帮助我。
最佳答案
您应该使用不同的 tag
属性创建警报 View ,以便在委托(delegate)方法中您可以轻松区分屏幕上显示的警报 View 。
例如:
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Info"
message:@"Message" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil] autorelease];
[alert setTag: 1001]; // give different tag to different alert views
[alert show];
[alert release];
现在在委托(delegate)方法中:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 1001)
{
// do something
}
eles if (alertView.tag == 1002)
{
}
}
希望对你有帮助..
关于iphone - 如何将一个 AlertView 与另一个 AlertView 一起显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8665986/