2011-08-18 59 views
0

我想使用presentModalViewController将新的视图添加到我的应用程序。使用presentModalViewController的新视图的位置问题

ASpotImageViewController *aSpotImage = [[ASpotImageViewController alloc] initWithNibName:@"ASpotImageView" bundle:nil spotID:spotid]; 
aSpotImage.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
//NSLog(@"frame is %@", aSpotImage.view.frame); 
//NSLog(@"origin is %@", aSpotImage.view.frame.origin); 
NSLog(@"description is %@", aSpotImage.description); 
[aSpotImage setModalPresentationStyle:UIModalPresentationFullScreen]; 
[self presentModalViewController:aSpotImage animated:YES]; 

但是,当我使用这个,新的视图出现约40像素左右的屏幕,底部被切断。什么可能导致这个?在我使用此代码的其他情况下,我没有这个问题。

回答

0

Gurooj,你实现试试这个

UINavigationController *nextController = [[UINavigationController alloc] initWithRootViewController:aSpotImage]; 
[self presentModalViewController: nextController animated: YES]; 

白色空间通常是导航栏的高度,我猜?

+0

这只会在屏幕上出现一个新的空白导航栏。它实际上留下了一个黑色空间,与我试图推动的新视图颜色相同。但父视图有白色的背景。这只会让我更加困惑。 – gurooj

0

您当前的容器的框架为(320,440,0,40),因此,当您呈现该框架时,它看起来被大量抵消了,尽管实际上它只是将其相对于父容器添加到位置(0,0)。修复方法是根据当前视图或父视图重新调整框架。

+0

我该怎么做?我尝试过手动调整框架,它似乎没有改变模态视图控制器中的任何东西。 – gurooj

+0

即使在横向模式下,如果我检查它告诉我的框架{0,0},{768,1024},这是纵向模式的尺寸,我在iPad上面临同样的问题。 – ophychius