2012-01-06 6 views
0

이메일 버튼이라는 하나의 버튼이 있어야 피커보기에서 여러 항목 중 하나를 선택하여 이메일을 통해 선택한 항목을 첨부 할 수 있습니다. 나는 IBAction에 머물러있다. 여기에 내 진전이있다.iOS : 피커 뷰 선택에서 여러 항목에서 하나의 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를 : 나는 당신의 코드에서 [self pickerEmail] 높은 전화를 이해하지 못하는

-(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?

답변

0

pickerEmail은의 객체가 될 것으로 보인다 메소드 MFMailComposeViewController을 입력하십시오. 그래서 전화 [self pickerEmail]은 Objective-C에 대해 아무런 의미가 없습니다

+0

OOP에 대한 이해를 통한 실질적인 학습으로 누군가 내게 맞는 지식을 제안 할 수있는 경우 여기까지 지식이 제한되어 있습니다. – Amink