1

Je voudrais ajouter le texte « Envoyé de » au bas du messageComment ajouter du texte au bas de mon 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]; 
     } 

Répondre

2

Vous pouvez définir le corps du message comme isHTML:YES et la ligne d'utiliser des sauts <br> ou essayez d'utiliser \n dans la chaîne setMessageBody

Ensuite, il suffit d'ajouter votre "envoyé de" message après cela.

0

essayer ce code, j'ai changé le code selon vos besoins

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

codage heureux ...

Questions connexes