iphone MFMessageComposeViewController, status bar problem
I'm using the following code to show in-app sms. My app don't have a status bar. (I'm using 320x480 pixels screen in portrait view)
if ([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController* msgController = [[MFMessageComposeViewController alloc] init];
msgController.recipients = [NSArray arrayWithObject:self.globalSMS];
msgController.messageComposeDelegate = self;
[self presentModalViewController:msgController animated:YES];
[msgController release];
}
This is working good to display the message view controller. (But status bar comes back, which is not necessary for me to show) But the problem is that when I click "Cancel" or "Send", after going back to application, I am seeing white space on the top (in position of status bar) of the screen. And status bar is hidden. Why is it happening w开发者_如何学Gohen my status bar is set as hidden in app delegate. How to get rid of white space after showing the in-app sms view.
Hide the status bar after you modal presented the message controller. Something like this:
controller.wantsFullScreenLayout = NO;
[self presentModalViewController:controller animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
Also Answered here: MFMessageComposeViewController not properly displayed
I found the answer. We've to set in view controller's viewDidLoad method:
self.wantsFullScreenLayout = YES;
The issue is in portrait view. From what I am seeing if the MFMessageComposeViewController loads in landscape the space isn't there. Then if the orientation changes to portrait the layout is corrected and the space isn't present in portrait.
Note When in landscape the MFMessageComposeViewController is presented by sliding from left to right. I believe that the way the view is presented holds to key to fixing the issue.
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText]){
controller.body = @"MessageText!!!";
controller.recipients = [NSArray arrayWithObjects:@"123"];
controller.messageComposeDelegate = self;
controller.wantsFullScreenLayout = YES;
[self presentModalViewController:controller animated:YES];
}
精彩评论