基本上,我尝试做的是添加多个确认警报......但我无法让它工作。无论我按什么确认警报,“继续”按钮都会导致完全相同的事情(没有文字的正文和带有“XXXX”的主题)......知道如何使确认警报导致不同的事情吗?
编辑2;无论我按什么按钮(继续或关闭),应用程序都会将用户发送到 mail.app...
-(IBAction)mail {
UIAlertView *mail = [[UIAlertView alloc] init];
[mail setTag:ALERTVIEW_MAIL_TAG];
[mail setTitle:@"Open mail"];
[mail setMessage:@"....."];
[mail setDelegate:self];
[mail addButtonWithTitle:@"Continue"];
[mail addButtonWithTitle:@"Dismiss"];
[mail show];
[mail release];
}
-(IBAction)feedback {
UIAlertView *feedback = [[UIAlertView alloc] init];
[feedback setTag:ALERTVIEW_TIPSA_TAG];
[feedback setTitle:@"Open mail"];
[feedback setMessage:@"....."];
[feedback setDelegate:self];
[feedback addButtonWithTitle:@"Continue"];
[feedback addButtonWithTitle:@"dismiss"];
[feedback show];
[feedback release];
}
- (void)showConfirmAlert
{
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if([alertView tag] == ALERTVIEW_FEEDBACK_TAG) {
NSURL *url = [[NSURL alloc] initWithString:@"mailto:?subject=XXXX"];
[[UIApplication sharedApplication] openURL:url];
[url release];
}
else if (buttonIndex == 1) {
}
else if ([alertView tag] == ALERTVIEW_MAIL_TAG) {
NSString *subject = @"YYYY";
NSString *body = @".....";
NSString *path = [NSString stringWithFormat:@"mailto:?subject=%@&body=%@", subject, body];
NSURL *url = [NSURL URLWithString:[path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];
}
else if (buttonIndex == 1) {
}
}