I am new in IOS development .Now i implement a UINavigationController to a UIViewController, but this give a gap from the top of the view .What is the reason for this? and How can avoid this gap?
This is My code
- (void)viewDidLoad
{
[self.view setBackgroundColor:[UIColor greenColor]];
SubClass *subClass=[[SubClass alloc]initWithNibName:@"SubClass" bundle:nil];
UINavigationController *navi=[[UINavigationController alloc]initWithRootViewController:subClass];
[self.view addSubview:navi.view];
[super viewDidLoad];
}
The Following is the Output.
If anybody know please help me. Thanks in advance.
U can add one more line
[navi.view setFrame: [self.view bounds]];
- (void)viewDidLoad
{
[self.view setBackgroundColor:[UIColor greenColor]];
SubClass *subClass=[[SubClass alloc]initWithNibName:@"SubClass" bundle:nil];
UINavigationController *navi=[[UINavigationController alloc]initWithRootViewController:subClass];
[navi.view setFrame: [self.view bounds]];
[self.view addSubview:navi.view];
[super viewDidLoad];
}