UINavigationBar出现在StatusBar 20分

时间:2011-05-14 04:05:18

标签: iphone

我使用下面的代码在窗口上显示视图(ViewController)。

ViewImagesController *vvViewImagesController=[[ViewImagesController alloc] init  ];
self.vViewImagesController=vvViewImagesController;
[vvViewImagesController release];
UINavigationController *a=[[UINavigationController alloc]initWithRootViewController: vViewImagesController];
[self.view addSubview:a.view];

但导航栏出现在状态栏下方20点。

enter image description here

即使我使用代码:

[a.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)]; 

重新定位视图,但结果相同。

欢迎任何评论

2 个答案:

答案 0 :(得分:1)

这是你需要做的。它是1行,它的工作原理:

在vvViewImagesController中的viewDidLoad中:

[self.view setFrame: [self.view bounds]];

嗖!

答案 1 :(得分:0)

尝试改为

ViewImagesController *vvViewImagesController = [[ViewImagesController alloc] init];
UINavigationController *a = [[UINavigationController alloc] initWithRootViewController:vvViewImagesController];

[self presentModalViewController:a animated:YES];

[vvViewImagesController release];
[a release];