tôi gửi một email với tập tin đính kèm PDF, trong khi sử dụng UIDocumentInteractionController, như thế này:Làm cách nào tôi có thể đặt trường Tới và Chủ đề trong E-Mail được gửi bởi UIDocumentInteractionController?
tôi bắt đầu bằng cách hiển thị các tập tin PDF
-(void)showPDFFile
{
NSURL *url = [NSURL fileURLWithPath:_filePath];
if (url) {
_documentInteractionController =
[UIDocumentInteractionController interactionControllerWithURL:url];
[_documentInteractionController setDelegate: self];
[_documentInteractionController presentPreviewAnimated:YES];
}
}
- (UIDocumentInteractionController *)setupControllerWithURL:(NSURL *)fileURL
usingDelegate:(id <UIDocumentInteractionControllerDelegate>)interactionDelegate {
UIDocumentInteractionController *interactionController =
[UIDocumentInteractionController interactionControllerWithURL: fileURL];
[interactionController setDelegate: interactionDelegate];
return interactionController;
}
Khi các tập tin PDF được hiển thị, người dùng nhấp vào Tùy chọn "Xuất" và chế độ xem "Mở bằng" của iOS sẽ xuất hiện.
Nhấp vào email ngay bây giờ sẽ mở Trình điều khiển chế độ xem sẵn sàng để gửi email.
Làm cách nào để đặt trường Tới: CC/BCC và Chủ đề theo chương trình?
Cảm ơn bạn!
là bạn MFMailComposeViewController sử dụng để trình bày quan điểm email ?? – Suryakant
Tôi không. UIDocumentInteractionController đang làm việc cho tôi! Tôi đoán UIDocumentInteractionController là đại biểu cho MFMailComposeViewController. Trong bất kỳ kịch bản nào khác, tôi sẽ được ủy quyền cho MFMailComposeViewController và xử lý mọi thứ từ đó. – nmdias
Rất tiếc, API không hỗ trợ những gì bạn muốn. Lý tưởng nhất là bạn sẽ có thể sử dụng thuộc tính 'annotation' của' UIDocumentInteractionController' nhưng dường như nhà soạn thư không sử dụng thuộc tính (ít nhất là không có tài liệu nào cho biết có thể thực hiện được). – rmaddy