简体   繁体   English

调整MFMailComposeViewController的大小,并防止其覆盖整个屏幕

[英]Resize the MFMailComposeViewController and prevent it from covering the whole screen

I have a MFMailComposeViewController, and it's called using this method: 我有一个MFMailComposeViewController,它使用以下方法调用:

    - (IBAction)sendEmail:(id)sender {

    NSArray *toRecipents = [NSArray arrayWithObject:@"email@email.com"];

    MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
    mc.mailComposeDelegate = self;
    [mc setSubject:@"Email"];
    [mc setMessageBody:message.text isHTML:NO];
    [mc setToRecipients:toRecipents];

    // Present mail view controller on screen
    [self presentViewController:mc animated:YES completion:NULL];

}

I want when the controller loads up , I want his height to be 50 pixels less than the view's height, I don't want him to take the whole screen. 我想要控制器加载时,我希望他的高度比视图的高度小50像素,我不希望他占据整个屏幕。 Is there any way to do so?. 有什么办法吗?

EDIT: The problem I'm facing is, this MFMailComposeViewController I'm calling , is initially inside a view controller that was called using a modal page curl effect, so the curl effect is preventing me to push the send email button! 编辑:我面临的问题是,我正在调用的MFMailComposeViewController最初是在使用模态页面卷曲效果调用的视图控制器内部,因此卷曲效果阻止了我按下发送电子邮件按钮! this is a pic 这是一张照片

在此处输入图片说明

So no matter how much u try, u just can't click the send button…what can i do in this situation without getting rejected by apple 因此,无论您尝试多少,您都无法单击发送按钮...在这种情况下我该怎么办而不会被苹果拒绝

EDIT 2: Can i just close the modal curl page effect and then pop up this view controller? 编辑2:我可以只关闭模式卷曲页面效果,然后弹出此视图控制器吗?

As far as I know, there if no standard or allowed way to do what you want. 据我所知,没有标准或允许的方式来做您想要的事情。
Also I would be concerned about passing approval since Apple indicates the following regarding mail composer: 我还要担心是否会通过批准,因为Apple指出了有关邮件撰写者的以下事项:

Important: The view hierarchy of this class is private and you must not modify it. 要点:此类的视图层次结构是私有的,您不能对其进行修改。 You can, however, customize the appearance of an instance by using the UIAppearance protocol. 但是,您可以使用UIAppearance协议来自定义实例的外观。 After presenting a mail comopose view controller, your app cannot change the email content. 呈现邮件组合视图控制器后,您的应用无法更改电子邮件内容。 The user can edit the content of a presented instance but the system ignores programmatic changes. 用户可以编辑所呈现实例的内容,但是系统会忽略编程更改。 If you want to set values for the content fields, do so before presenting the interface. 如果要为内容字段设置值,请在显示界面之前进行设置。 class reference 类参考

If you've some custom design requirements for sending emails I'd recommend implementing your own views and using some server to send email, but I'm not sure how hard are your design requirements. 如果您对发送电子邮件有一些自定义设计要求,建议您实现自己的视图并使用一些服务器发送电子邮件,但是我不确定您的设计要求有多难。

Try to change frame of MFMailComposeViewController manually and use addSubview: instead of presentViewController:animated:completion: : 尝试手动更改MFMailComposeViewController框架,并使用addSubview:而不是presentViewController:animated:completion: ::

mc.view.frame = CGRectMake(0, 20, 320, 400);
// Use addSubview: insead of [self presentViewController:mc animated:YES completion:NULL];
[self.view addSubview:mc.view];

在此处输入图片说明

Notice: I am not sure this this behaviour would be passed through Apple App Store approval process. 注意:我不确定此行为是否会通过Apple App Store批准过程来实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM