基本上,我试图做的是添加多个confirmationalerts ...但我不能让它工作。无论我按什么确认按钮,“继续”按钮都会导致完全相同的事情(一个没有文本的主体和一个带有“XXXX”的主题)... 任何想法如何使confimationalerts导致不同的事情?添加多个confirmationalerts(UIAlertView)
编辑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) {
}
}
如果你想使用应用-Mail,您必须使用MessageUI.framework,例如以模式呈现MFMailComposeViewController – Felix 2011-01-11 20:20:22
我不想使用应用内邮件...我想将用户发送到mail.app – Krismutt 2011-01-11 20:22:32
对不起。我意识到我的错误。谢谢! – Krismutt 2011-01-11 20:34:05