dismissModalViewControllerAnimated将视图向下移动

时间:2009-12-22 07:00:45

标签: iphone

我正在使用dismissModalViewControllerAnimated来关闭我的MFMailComposeViewController。我遇到的问题是邮件视图背后的视图在返回视图时会稍微向下移动。

我无法弄清楚为什么会这样,有什么想法吗?

2 个答案:

答案 0 :(得分:1)

在我调用dismissModalViewControllerAnimated之后,我抓住视图的框架并将原点设置回(0,0)

它有效,但如果有人想出更好的答案,我会接受它,或者如果我想出更好的东西,我会编辑它,这似乎很愚蠢。

答案 1 :(得分:0)

我遇到了同样的问题。

我发现它是由我最初调整模态视图控件的父视图的方式引起的。

我正在使用[UIScreen mainScreen].bounds

现在这对我有用:

// 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
  [...]
}