Why doesn't my Mail Composer view display properly?
If I present the mail composer modally, it works fine (here, MFMailComposeViewController* _mailer);
[self presentModalViewController:_mailer animated:YES];
However, if I add the view to the current view,
[self.view addSubview: _mailer.view];
the composer view doesn't go all the way to the top of the window. There is a gap of a couple of lines between the top of the MFMailComposer
view and the status bar.
The reason I want to add the view instead of modal presentation is that I'm using a tab bar and I don't want it to be covered up. [You may be asking yourself, why doesn't he just attach the composer window to the tab bar directly? The reason is that the MFMailComposer
is part of a work flow launched from a tab but that doesn't start with the composer view].
The Apple documentation says:
To display the view managed by this view controller, you can use any of the standard techniques for displaying view controllers".
Does anyone have an idea as to why the gap at the top 开发者_运维技巧or how to get the mail composer to play nice?
Try setting the frame of the _mailer.view equal to the bounds of self.view. I imagine that its default frame is trying to compensate for the status bar being at the top. (my guess is that the origin of the view is defaulting to be 20 instead of 0)
精彩评论