基本上,我試圖做的是添加多個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