Marky
Marky

Reputation: 1314

MFMessageComposeViewController pushes my view down 20px. Why? How to fix?

I have an iPhone app which hides the status bar when run. After launching a MFMessageComposeViewController and dismissing it (after either send or cancel) all my previously drawn elements are shifted down 20px. This is clearly to do with the status bar showing when the MFMessageComposeViewController is presented.

Can I either stop this happening or fix it in my (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result method to undo the change?

Thanks :)

Upvotes: 2

Views: 1479

Answers (2)

MobileSandbox
MobileSandbox

Reputation: 11

After I launch the modal view picker is when I remove the status bar.
You may need to set it to NO when you return.

MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.wantsFullScreenLayout = NO;
NSString * currentString = nil;
currentString = [[NSString alloc] initWithFormat:@"Just a Test (iPhone/iPod/iPad)." ];  
picker.body = currentString;
[self presentModalViewController:picker animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES];

Upvotes: 1

Marky
Marky

Reputation: 1314

OK, turned out I needed to set:

self.wantsFullScreenLayout = YES;

in my view controller. this fixed it. perhaps it's useful to someone else.

Upvotes: 9

Related Questions