monsabre
monsabre

Reputation: 2099

UINavigationBar Appears Under StatusBar 20 points

I used the codes below to display an view(ViewController) on window.

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

but the navigation bar appeared underneath the status bar 20 points.

enter image description here

Even I use the codes:

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

to relocate the view, but the result is same.

Welcome any comment

Upvotes: 1

Views: 1577

Answers (2)

Henley Wing Chiu
Henley Wing Chiu

Reputation: 22535

Here's what you need to do. It's 1 line and it works:

In viewDidLoad in vvViewImagesController:

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

Whoosh!

Upvotes: 1

user498982
user498982

Reputation:

try instead

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

[self presentModalViewController:a animated:YES];

[vvViewImagesController release];
[a release];

Upvotes: 0

Related Questions