2013-01-05 1 views
0

사용자가 이메일로 지원 팀에 문의 할 수있는 연락 버튼을 만듭니다 (iOS 6 사용). 하지만 Mail Composer는 지원 팀의 전자 메일 만 전자 메일로 보내고 사용자가받는 사람 전자 메일 주소를 추가하거나 삭제하지 못하도록하고 싶습니다.iOS에서 메일의받는 사람을 한 명만 허용하는 방법

DemoProject.h

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h> 

@interface SimpleEmailViewController : UIViewController <MFMailComposeViewControllerDelegate> // Add the delegate 
- (IBAction)showEmail:(id) 

DemoProject.m는

- (IBAction)showEmail:(id)sender { 
    // Email Subject 
    NSString *emailTitle = @"Test Email"; 
    // Email Content 
    NSString *messageBody = @"iOS programming is so fun!"; 
    // To address 
    NSArray *toRecipents = [NSArray arrayWithObject:@"[email protected]"]; 

    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init]; 
    mc.mailComposeDelegate = self; 
    [mc setSubject:emailTitle]; 
    [mc setMessageBody:messageBody isHTML:NO]; 
    [mc setToRecipients:toRecipents]; 

    // Present mail view controller on screen 
    [self presentViewController:mc animated:YES completion:NULL]; 

} 

- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error 
{ 
    switch (result) 
    { 
     case MFMailComposeResultCancelled: 
      NSLog(@"Mail cancelled"); 
      break; 
     case MFMailComposeResultSaved: 
      NSLog(@"Mail saved"); 
      break; 
     case MFMailComposeResultSent: 
      NSLog(@"Mail sent"); 
      break; 
     case MFMailComposeResultFailed: 
      NSLog(@"Mail sent failure: %@", [error localizedDescription]); 
      break; 
     default: 
      break; 
    } 

    // Close the Mail Interface 
    [self dismissViewControllerAnimated:YES completion:NULL]; 
} ` 

답변

2

당신은을 제한 할 수 없습니다. 필드를 미리 채울 수는 있지만 사용자가받는 사람을 편집 할 수 없도록 제한 할 수는 없습니다.

+0

Ok 고맙습니다. :) – iProgrammed