UiAlertView çakışması hk.
Arkadaşlar Merhaba
AlertView kullanıyorum iki tane farklı action butonlarında fakat çakışma meydana geliyor 1 ci alertview butonları düzgün çalışmasına rağmen diğer action butonuna bastığımda çıkan alertview butonları 1cinin görevlerini gerçekleştiriyor.kodlar aşağıdaki gibi yardımcı olursanız sevinirim.
-(IBAction)sendMailhedef:(id)sender
{
UIAlertView * birinci =[[UIAlertView alloc] initWithTitle:@"Birinci Alert View" message:@"Sube Seçimi" delegate:self cancelButtonTitle:@"Vazgeç" otherButtonTitles:@"Bağcılar",@"Beylikdüzü",@"Seyrantepe",@"Maslak" ,nil];
[birinci show];
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==1)
{
{
NSArray *recipients = [NSArray arrayWithObjects:@"ornek@hotmail.com", nil];
// email Subject
NSString *subject = @"merhaba hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
[Composer setCcRecipients:ccRecipients];
//get the filePath resource
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
//Read the file using NSData
// NSData *fileData = [NSData dataWithContentsOfFile:filePath];
// NSString *mimeType = @"image/png";
//Add attachement
//[Composer addAttachmentData:fileData mimeType:mimeType fileName:filePath];
//Present it on the screen
[self presentViewController:Composer animated:YES completion:nil];
}}
else if (buttonIndex==2)
{
NSArray *recipients = [NSArray arrayWithObjects:@"ornek2@hotmail.com.tr", nil];
// email Subject
NSString *subject = @"selam hk.";
//email body
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
//get the filePath resource
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
//Read the file using NSData
// NSData *fileData = [NSData dataWithContentsOfFile:filePath];
// NSString *mimeType = @"image/png";
//Add attachement
//[Composer addAttachmentData:fileData mimeType:mimeType fileName:filePath];
//Present it on the screen
[self presentViewController:Composer animated:YES completion:nil];
}
else if (buttonIndex==3)
{
NSArray *recipients = [NSArray arrayWithObjects:@"merhaba@icloud.com", nil];
NSString *subject = @"merhaba hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
[self presentViewController:Composer animated:YES completion:nil];
}
else if (buttonIndex==4)
{
NSArray *recipients = [NSArray arrayWithObjects:@"erhan@hotmail.com" nil];
NSString *subject = @"reyhan hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
[self presentViewController:Composer animated:YES completion:nil];
}
}
-(IBAction)sendMaildigeri:(id)sender
{
UIAlertView * ikinci =[[UIAlertView alloc] initWithTitle:@"Depo" message:@"Sube Seçimi" delegate:self cancelButtonTitle:@"Vazgeç" otherButtonTitles:@"Güneşli",@"Kağıthane",@"Trakya", nil];
[ikinci show];
}
-(void)alertViews:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex==1)
{
{
NSArray *recipients = [NSArray arrayWithObjects:@"burak@yahoo.com", nil];
NSString *subject = @"Sipariş hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
[self presentViewController:Composer animated:YES completion:nil];
}}
else if (buttonIndex==2)
{
NSArray *recipients = [NSArray arrayWithObjects:@"e.bozar@yahoo.com", nil];
NSString *subject = @"Sipariş hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
[self presentViewController:Composer animated:YES completion:nil];
}
else if (buttonIndex==3)
{
NSArray *recipients = [NSArray arrayWithObjects:@"g.atalay@yahoo.com", nil];
NSString *subject = @"Sipariş hk.";
MFMailComposeViewController *Composer = [[MFMailComposeViewController alloc]init];
Composer.mailComposeDelegate = self;
[Composer setSubject:subject];
[Composer setMessageBody:body isHTML:NO];
[Composer setToRecipients:recipients];
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"logo" ofType:@"jpg"];
[self presentViewController:Composer animated:YES completion:nil];
}
}