ios – 导航栏没有显示

ios – 导航栏没有显示,第1张

概述这里我有2个看法: > WelcomeVC > WebViewVC 第一个AppDelegate通过以下代码调用WelcomeVC: - (void)presentWelcomeViewController WelcomeViewController *welcomeViewController = [[WelcomeViewController alloc] initWithNibNa 这里我有2个看法:

> WelcomeVC
> WebVIEwVC

第一个AppDelegate通过以下代码调用WelcomeVC:

- (voID)presentWelcomeVIEwController     WelcomeVIEwController *welcomeVIEwController = [[WelcomeVIEwController alloc] initWithNibname:@"WelcomeVIEwController" bundle:nil];    welcomeVIEwController.Title = @"Welcome to My App";    UINavigationController *navController = [[UINavigationController alloc] initWithRootVIEwController:welcomeVIEwController];    navController.navigationbarHIDden = YES;    self.vIEwController = navController;    self.window.rootVIEwController = self.vIEwController;}

所以在WelcomeVC中,导航栏没有显示navController.navigationbarHIDden = YES;.在WelcomeVC中,有一个按钮可以调用WebVIEwVC,详情如下:

- (IBAction)termspressed:(ID)sender {    WebVIEwController *webVIEwController = [[WebVIEwController alloc] initWithNibname:nil bundle:nil];    NSLog(@"Terms of Use");    webVIEwController.urlPassed = @"http://.../term.HTML";    webVIEwController.Title = NSLocalizedString(@"Terms of Use",nil);    [webVIEwController.navigationController setNavigationbarHIDden:NO animated:NO];    [self.navigationController presentVIEwController:webVIEwController animated:YES completion:^{}];    }

当按下这个按钮时,我希望它用我所做的导航栏调用WebVIEwVC [webVIEwController.navigationController setNavigationbarHIDden:NO animated:NO];但我发现WebVIEwVC仍然没有导航栏.我还在WebVIEwVC中包含了vIEwDIDLoad,如下所示:

- (voID)vIEwDIDLoad {    [super vIEwDIDLoad];    CGSize screenSize = [[UIScreen mainScreen] bounds].size;    if(screenSize.height == 480)    {        webVIEw = [[UIWebVIEw alloc] initWithFrame:CGRectMake(0,320,480)];    }    else if(screenSize.height == 568)    {        webVIEw = [[UIWebVIEw alloc] initWithFrame:CGRectMake(0,568)];    }    [webVIEw loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlPassed]]];    [self.vIEw addSubvIEw:webVIEw];}

有谁请帮助指导我在哪里错过或做错了?非常感谢.提前致谢!

解决方法 在这里,我通过更改WelcomeVC中按钮的代码找到了一个解决方案:

- (IBAction)termspressed:(ID)sender {    WebVIEwController *webVIEwController = [[WebVIEwController alloc] initWithNibname:nil bundle:nil];    NSLog(@"Terms of Use");    webVIEwController.urlPassed = @"http://.../term.HTML";    UINavigationController *webVIEwNavController =[[UINavigationController alloc] initWithRootVIEwController:webVIEwController];    webVIEwNavController.navigationbarHIDden = NO;    webVIEwNavController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;    [self presentVIEwController:webVIEwNavController animated:YES completion:nil];}
总结

以上是内存溢出为你收集整理的ios – 导航栏没有显示全部内容,希望文章能够帮你解决ios – 导航栏没有显示所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1058139.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存