質問

I used the MFMailComposeViewController a lot in the past but for some reason now there is a very strange behaviour...that creates lots of problem in the usability of the interface....

Issue #1: fields are not editable or the focus seems wrongly positioned.

I create an email to be sent with an attachment (text or pdf) and each time the controller starts the "cc/bcc/from" fields overlap and are not editable. if i tap on the "to:" field sometimes the keyboards appears other times it doesn't ... The "to:"field is the only one editable (in blue) but clearly the focus is not right because sometimes i can edit the email address, other times, it becomes a completely blue box (no text is visible), etc.etc.

At times the "cc:"field is expanded on a row but the tap position is not exactly right and no editing is possible.

Issue #2: the keyboards loads fast the first time, but if i close the composer and open it again, this time the keyboard takes at least 5 seconds to show up.

I tested the process on both iPad2 with IOS7 and in debug mode on Xcode 5.1 but the behaviour is always the same.
What i tried so far:

  1. set the mail composer as first responder, each time i open it: not working
  2. create temporary uitextfields to "pre-load" the keyboard: not working
  3. change the modal appearance from full screen to form sheets/pagesheet/etc: not working

it seems to be memory related,at least the keyboard part, because at the beginning the App uses ~16 MBytes and the second time slightly higher (~26 Mbytes), but not big changes.

The process flow for both issues:

  • You tap a send button, the mail composer opens, tap in the body and the keyboard appears.(still the email fields overlaps and not editable).
  • You close it, you click again the send button, you do exactly the same moves but this time the keyboard does not show up , the "cc:/bcc:" fields are indented wrongly (on the left), nothing can be edited.

I have already gone through several answers/questions on this forum but nothing seems to work and this thing is really driving me mad...no more than 4 line of code (taken from Apple docs) and it does not work...

役に立ちましたか?

解決

I had the same issue on ios6. (I've not tested this on ios7) Try these two methods before showing the MFMailComposeViewController,

[self.parentViewController resignFirstResponder];

And this one on the mailComposer,

[self becomeFirstResponder];

Note - This answer is for your issue #1

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top