2 lantianyiming lantianyiming 于 2013.07.18 11:19 提问

隐藏或删除顶部的导航条

代码成功运行,但是在页面顶部多出来一个导航条,我想隐藏起来或者删除。

ClsMainPageAppDelegate.m

#import "ClsMainPageAppDelegate.h"
#import "ClsTermsandConditionViewController.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
    ClsTermsandConditionViewController *ivc = [storyboard instantiateViewControllerWithIdentifier:@"termsandConditionControl"];
    UINavigationController *navigationController=[[UINavigationController alloc] initWithRootViewController:ivc];
    self.window.rootViewController=nil;
    self.window.rootViewController = navigationController;
    [self.window makeKeyAndVisible];
}

2个回答

lanhailvcao
lanhailvcao   2013.07.18 15:48
已采纳

读一下文件说明: UINavigationController Class Reference

[navigationController setNavigationBarHidden:YES];
zhanglei5415
zhanglei5415   Rxr 2013.07.18 13:43

在ClsTermsandConditionViewController.m文件的viewWillAppear 或 viewDidLoad中加入如下代码

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES];
}
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!