gpt4 book ai didi

ios - subview 添加到导航栏 ios

转载 作者:行者123 更新时间:2023-11-28 22:52:14 26 4
gpt4 key购买 nike

我在 Ipad 上将 View 显示为 navigationController.view 的 subview 时遇到问题。我需要在我的 viewController(带有 navBar)上显示具有透明背景的 View ,但是当我改变方向时,我的 navBar 在我的 View 的前景中变得可见;我创建了基于简单 View 的应用程序。这是我添加到项目中的代码:

AppDelegate.h:

UINavigationController *_navController;

@property (strong, nonatomic) UINavigationController *navController;

AppDelegate.m:

_navController = [[[UINavigationController alloc] initWithRootViewController:self.viewController] autorelease];
self.window.rootViewController = _navController;

ViewController.m:

- (void)viewDidLoad
{
[super viewDidLoad];
UIView *view = [[[UIView alloc] initWithFrame:self.view.frame] autorelease];
[view setBackgroundColor:[UIColor redColor]];

[self.navigationController.view addSubview:view];
}

最佳答案

尝试将 View 推送到导航 Controller

 YourAppDelegate *del = (YourAppDelegate *)[UIApplication sharedApplication].delegate;
[del.navigationController pushViewController:nextViewController animated:YES];

UINavigationController* navigation = [[UINavigationController alloc] init];
iVkViewController *overviewViewController = [[iVkViewController alloc] init];
overviewViewController.title = @"First";
[navigation pushViewController:overviewViewController animated:NO];

关于ios - subview 添加到导航栏 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11664120/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com