给项目添加一个navigationcontroller,但是发现在navigationBar和自己写的布局中间会有大约20像素的空隙,现在用的是ios sdk6 xode4.5
以前用sdk5.0 xcode4.2的时候不会有这样的现象的
这是怎么回事呢
没加的时候
加了以后
加了以后隐藏
代码如下
还有这个是初始页面,通过跳转回到这个页面的时候却没问题了
- (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=[[UINavigationController
alloc]initWithRootViewController:self.viewController];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
因为你的view初始化时写的
initWithFrame:CGRectMake(0,20,320,xxx),这个frame是相对屏幕的现在加了navigation bar之后,frame是相对于navigation bar的,应该改为