jan
jan

Reputation: 893

dismissModalViewControllerAnimated shifts view down

I'm using dismissModalViewControllerAnimated to dismiss my MFMailComposeViewController. The problem I'm having is that the view behind the mail view gets shifted down a bit when it comes back into view.

I haven't been able to figure out why this is happening, any thoughts?

Upvotes: 2

Views: 1271

Answers (2)

Jean Regisser
Jean Regisser

Reputation: 6716

I was having the same issue.

I found out that it was caused by the way I initially sized the view of the parent of the modal viewcontroller.

I was using [UIScreen mainScreen].bounds

This is now what is working for me:

// loadView method of the parent of the modal view controller
- (void)loadView {
  CGRect frame = [UIScreen mainScreen].applicationFrame;
  self.view = [[[UIView alloc] initWithFrame:frame] autorelease];
  [self.view setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
  // Below is the actual code with the content of the view
  [...]
}

Upvotes: 0

jan
jan

Reputation: 893

After I call dismissModalViewControllerAnimated I grab my view's frame and set the origin back to (0,0)

It works but this seems silly to have to do so if anyone comes up with a better answer I'll accept it or if I figure something better out I'll edit this.

Upvotes: 1

Related Questions