Как я могу добавить текст в нижней части моего MFMailComposeViewController? - PullRequest
1 голос
/ 28 июля 2010

Я хотел бы добавить текст "Отправлено" в конец сообщения

if([MFMailComposeViewController canSendMail]){
       MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
       controller.mailComposeDelegate = self;
       [controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
       [controller setMessageBody:[NSString stringWithFormat:@"%@",self.cellBody] isHTML:NO];
       [self presentModalViewController:controller animated:YES];
       [controller release];
      }
      else {
       UIAlertView *alertView;
       alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
       [alertView show];
       [alertView release];
      }

Ответы [ 2 ]

2 голосов
/ 28 июля 2010

Вы можете установить тело сообщения как isHTML:YES и использовать разрывы строк <br> или попробовать использовать \n в строке setMessageBody

Затем просто добавьте свое сообщение «от кого» после этого.

0 голосов
/ 24 августа 2010

Попробуйте этот код. Я изменил код согласно вашему требованию

if([MFMailComposeViewController canSendMail]){
       MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
       controller.mailComposeDelegate = self;
       [controller setSubject:[NSString stringWithFormat:@"A message from: %@",self.profileName]];
       [controller setMessageBody:[NSString stringWithFormat:@"%@\nSent from : %@",self.cellBody,self.profileName] isHTML:NO];
       [self presentModalViewController:controller animated:YES];
       [controller release];
      }
      else {
       UIAlertView *alertView;
       alertView = [[UIAlertView alloc] initWithTitle:@"E-Mail Not Enabled" message:@"E-Mail is not supported on this device" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
       [alertView show];
       [alertView release];
      }

Happy Coding ...

...