Reputation: 603
I have a share functionality in my app.when I open the MFMailComposeViewController for send email.Then sometimes it hides the navigation bar.Because in my app I have used custom navigation bar.So I have to hide the navigation controller on all screens.But when email pop up appears then I have unhide the navigation controller for show send or cancel button.But it does not appear sometime.Below is my code.Please tell me what I have done wrong in my code.I have tried all methods but I have unable to replicate this issue.
if ( MFMailComposeViewController.canSendMail())
{
self.navigationController?.setNavigationBarHidden(false, animated: true)
self.navigationController?.navigationBar.isHidden=false
print("Can send email.")
let mailComposer = MFMailComposeViewController()
mailComposer.mailComposeDelegate = self
mailComposer.navigationBar.barTintColor = UIColor.black
mailComposer.navigationBar.tintColor = UIColor.white
mailComposer.isNavigationBarHidden=false
mailComposer.navigationBar.isHidden=false
UINavigationBar.appearance().isTranslucent = false
mailComposer.setSubject("")
mailComposer.setMessageBody(myHTMLString, isHTML: true)
// mailComposer.setToRecipients([to_Email_Id])
self.present(mailComposer, animated: true, completion: {
self.navigationController?.navigationBar.isHidden=false
mailComposer.isNavigationBarHidden=false
mailComposer.navigationBar.isHidden=false
UINavigationBar.appearance().isTranslucent = false
})
}
Upvotes: 1
Views: 367