給項(xiàng)目添加一個(gè)navigationcontroller,但是發(fā)現(xiàn)在navigationBar和自己寫(xiě)的布局中間會(huì)有大約20像素的空隙,現(xiàn)在用的是ios sdk6 xode4.5以前用sdk5.0 xcode4.2的時(shí)候不會(huì)有這樣的現(xiàn)象的這是怎么回事呢代碼如下還有這個(gè)是初始頁(yè)面,通過(guò)跳轉(zhuǎn)回到這個(gè)頁(yè)面的時(shí)候卻沒(méi)問(wèn)題了- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];self.viewController = [[RootViewController alloc]
initWithNibName:@"RootViewController" bundle:nil];self.window.rootViewController = self.viewController;self.navigationController=[[UINavigationControlleralloc]initWithRootViewController:self.viewController];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];return YES;
}
1 回答

至尊寶的傳說(shuō)
TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超10個(gè)贊
因?yàn)槟愕膙iew初始化時(shí)寫(xiě)的 initWithFrame:CGRectMake(0,20,320,xxx)
,這個(gè)frame是相對(duì)屏幕的
現(xiàn)在加了navigation bar之后,frame是相對(duì)于navigation bar的,應(yīng)該改為
initWithFrame:CGRectMake(0,0,320,xxx)
- 1 回答
- 0 關(guān)注
- 191 瀏覽
添加回答
舉報(bào)
0/150
提交
取消