Reputation: 111
I have saved a normal ".txt" file with a customized file name. While displaying this file in QLPreviewController and tapping "Mail" option, the attached file name is same as that i have given while saving it. I want to change the name of the file while displaying in "MAIL". Is it possible to do so? Thanks for your answer
Upvotes: 2
Views: 961
Reputation: 6551
I hope this is what you need..
[mailComposer addAttachmentData:[NSData dataWithContentsOfFile:self.yourFilePath]
mimeType:@"application/txt" fileName:[NSString stringWithFormat:@"MAIL.txt"]];
Upvotes: 0
Reputation: 1263
You can do it the other way round: save under the name you want to appear in Mail.app and customize name in QLPreviewController by implementing:
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)idx
and customizing QLPreviewItem
returned from it (previewItemTitle
).
Upvotes: 1