MFMailComposeViewController显示定位

发布于 2024-12-28 18:15:44 字数 1487 浏览 0 评论 0原文

当我调用 Apple 的 MFMailComposeViewController 类从我的应用程序发送电子邮件时,“收件人”、“抄送”、“密件抄送”和“主题”的位置有点偏离。它们的字体大小比预期的小了大约 1/2(例如,当您单击编辑主题时,您只能看到文本的上半部分)。即使我将 Apple 的示例复制并粘贴到我的代码中,也会发生这种情况。有人见过这个吗?我一直在论坛中搜索,但看不到其他人有过这种经历。

我正在使用的代码

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"]; 

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];  
[picker setBccRecipients:bccRecipients];

// Fill out the email body text
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];

When I call Apple's MFMailComposeViewController class to send an email from my app, the placement of the To, Cc, Bcc and Subject is a little off. They appear about 1/2 the font size down further than they are supposed to be (when you click the edit the subject, for example, you can only see the top half of the text). This happens even when I copy and paste Apple's sample right into my code. Has anyone seen this before? I've been searching through forums and can't see anybody else who has experienced this.

Code I'm using

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;

[picker setSubject:@"Hello from California!"];

// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]", @"[email protected]", nil]; 
NSArray *bccRecipients = [NSArray arrayWithObject:@"[email protected]"]; 

[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];  
[picker setBccRecipients:bccRecipients];

// Fill out the email body text
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];

[self presentModalViewController:picker animated:YES];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱娆 2025-01-04 18:15:44

尝试下面的代码:

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSString * subj = [NSString stringWithFormat:@"" ];
    [picker setSubject:subj];


    // Set up recipients
    NSArray *toRecipients = [[NSArray alloc] initWithObjects:@"[email protected]",nil];
        NSArray *ccRecipients = [[NSArray alloc] initWithObjects::@"[email protected]",@"[email protected]", nil]; 
NSArray *bccRecipients = [[NSArray alloc] initWithObjects::@"[email protected]"]; 


    [picker setToRecipients:toRecipients];
        [picker setCcRecipients:ccRecipients];  
        [picker setBccRecipients:bccRecipients]
    [toRecipients release];
        [ccRecipients release];
        [bccRecipients release];

    NSString *body = @"";

    [picker setMessageBody:body isHTML:NO]; 
    [self presentModalViewController:picker animated:YES];
        [picker release];

Try the below code:

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSString * subj = [NSString stringWithFormat:@"" ];
    [picker setSubject:subj];


    // Set up recipients
    NSArray *toRecipients = [[NSArray alloc] initWithObjects:@"[email protected]",nil];
        NSArray *ccRecipients = [[NSArray alloc] initWithObjects::@"[email protected]",@"[email protected]", nil]; 
NSArray *bccRecipients = [[NSArray alloc] initWithObjects::@"[email protected]"]; 


    [picker setToRecipients:toRecipients];
        [picker setCcRecipients:ccRecipients];  
        [picker setBccRecipients:bccRecipients]
    [toRecipients release];
        [ccRecipients release];
        [bccRecipients release];

    NSString *body = @"";

    [picker setMessageBody:body isHTML:NO]; 
    [self presentModalViewController:picker animated:YES];
        [picker release];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文