2011-12-19 14 views
1

私はIOS開発の新機能です.UINavigationControllerをUIViewControllerに実装していますが、これはビューの上部からギャップを空けています。どのようにこのギャップを避けることができますか?iosアプリケーションでuinavigationcontrollerをuiviewcontrollerにロードする方法

これは、次のように出力されます私のコード

- (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]; 
} 

です。

enter image description here

誰もが知っている場合は、私を助けてください。前もって感謝します。

答えて

1

Uが1行を追加することができ

[navi.view setFrame:[self.view境界]。

- (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]; 
} 
+0

またはnavi.viewのフレームをこの[navi.view setFrame:CGRectMake(0、0、320、480)]のように設定する必要があります。 –

関連する問題