当前位置: 动力学知识库 > 问答 > 编程问答 >

iphone - Mail Compose View Controller is delayed in swift for ios objective c?

问题描述:

I have this code to send feedback email , it works fine however the email container takes some time to show title and receiver attributes, Moreover typing in the email is disabled for like 4 seconds then is becomes active.

here is the code:

 @IBAction func sendEmailButtonTapped(sender: AnyObject) {

if MFMailComposeViewController.canSendMail() {

let mailComposeViewController = configuredMailComposeViewController()

self.presentViewController(mailComposeViewController, animated: true, completion: nil)

} else {

self.showSendMailErrorAlert()

}

}

func configuredMailComposeViewController() -> MFMailComposeViewController {

var mailComposerVC = MFMailComposeViewController()

mailComposerVC.mailComposeDelegate = self // Extremely important to set the --mailComposeDelegate-- property, NOT the --delegate-- property

mailComposerVC.navigationBar.tintColor = UIColor.whiteColor()

var font : UIFont = UIFont(name: "DroidArabicKufi", size: 12)!

mailComposerVC.navigationBar.titleTextAttributes = [NSFontAttributeName : font, NSForegroundColorAttributeName : UIColor.whiteColor()]

mailComposerVC.setToRecipients(["[email protected]"])

mailComposerVC.setSubject("subject")

mailComposerVC.setMessageBody("", isHTML: false)

return mailComposerVC

}

网友答案:

Generally MFMailComposeViewController is a little slow on the simulator but you don't have to worry about it. This happens mostly the first time you fire the simulator and later it is fast.The same happens with UIActivityViewController to open share and action extensions. My suggestion is, it would not be a problem with your code, just test the same on the device mostly it should work fine.

分享给朋友:
您可能感兴趣的文章:
随机阅读: