ユーザーがメールを送信するときに表示したい2つのUITextViewがあります。問題は、2番目のテキストビューのテキストをメールの新しい行に表示したいということです。
NSLogを試してみましたが、問題なく動作します。メールAPIに問題がありますか、それとも正しく動作しないのですか?
私のコードは次のようになります。
NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);
-(void)displayComposerSheet
{MFMailComposeViewController * picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self;
[picker setSubject:titleLabel.text];
NSString *desc = descriptionTextView.text;
NSString *ingredients = ingredientsTextView.text;
NSString *emailBody = [NSString stringWithFormat:@"%@\n\n%@", desc, ingredients];
NSLog(@"%@\n\n%@", desc, ingredients);
[picker setMessageBody:emailBody isHTML:YES];
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)viewDidLoad {
titleLabel.text = [recipeData valueForKey:@"title"];
descriptionTextView.text = [recipeData valueForKey:@"description"];
ingredientsTextView.text = [recipeData valueForKey:@"ingredients"];
[super viewDidLoad];
}