Как я могу добавить текст к нижней части моего MFMailComposeViewController?

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

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];
      }
1
задан Sheehan Alam 28 July 2010 в 18:59
поделиться

2 ответа

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

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

2
ответ дан 2 September 2019 в 22:39
поделиться

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

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];
      }

Удачного кодирования...

0
ответ дан 2 September 2019 в 22:39
поделиться
Другие вопросы по тегам:

Похожие вопросы: