0
電子メールボタンと呼ばれるボタンが1つあれば、ピッカービューから複数のアイテムを1つ選択して、その選択したアイテムを電子メールで添付する必要があります。私はIBActionで立ち往生しています。ここに私の進歩があります。iOS:ピッカービュー選択の複数の項目から1つのIBActionで送信者を取得するにはどうすればよいですか?
Mファイル:
-(void)pickerViewEmail:(UIPickerView *)pickerViewEmail didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
if ([[musicList objectAtIndex:row] isEqual:@"m1"])
{
MFMailComposeViewController *pickerEmail = [[MFMailComposeViewController alloc] init];
pickerEmail.mailComposeDelegate = self;
NSString *path = [[NSBundle mainBundle] pathForResource:@"m1" ofType:@"mp3"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[pickerEmail addAttachmentData:myData mimeType:@"audio/mp3" fileName:@"m1"];
[pickerEmail setSubject:@"Hello!"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil];
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"];
[pickerEmail setToRecipients:toRecipients];
[pickerEmail setCcRecipients:ccRecipients];
[pickerEmail setBccRecipients:bccRecipients];
// Fill out the email body text
NSString *emailBody = @"Hello";
[pickerEmail setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:pickerEmail animated:YES];
[pickerEmail release];
}
if ([[musicList objectAtIndex:row] isEqual:@"m2"])
{
}
if ([[musicList objectAtIndex:row] isEqual:@"m3"])
{
}
IBAction:
-(IBAction)showEmail
{
if ([MFMailComposeViewController canSendMail])
{
[self pickerEmail]; I have a yellow error when i call this. What is the right solution?
}
else
{
}
}
iOS : How to attach a multiple attachment file in one button using pickerview method?
私の知識はここに限られています。 – Amink