我实现了下面的代码,并记录了arrayPlainText
它,但是当我在模拟器和我的 iPhone 上运行它时,它只显示第一项,其他所有内容都消失了。
NSMutableArray *xmlListContent;
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:[self returnListPath]])
{
xmlListContent = [[NSMutableArray alloc] initWithContentsOfFile:[self returnListPath]];
NSMutableArray *listContent = [[NSMutableArray alloc] init];
int i;
for(i = 0; i < [xmlListContent count]; i++)
{
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
[mailComposer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[mailComposer setSubject:editedListTitle];
[mailComposer setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
NSString *item = [NSString stringWithString:[[xmlListContent objectAtIndex:i] objectForKey:@"label"]];
NSString *tempString = [NSString stringWithFormat:@"-%@",item];
[listContent addObject:tempString];
NSString *arrayPlainText = [listContent componentsJoinedByString:@"<br>"];
[mailComposer setMessageBody:[NSString stringWithFormat:@"<html>%@</html>",arrayPlainText] isHTML:YES];
DLog(arrayPlainText);
[self presentModalViewController:mailComposer animated:YES];
}
}
}
else
{
xmlListContent = [NSMutableArray array];
DLog(@"failed to compose list via email");
}