0

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

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];
}
4

1 回答 1

2

尝试将视图推送到导航控制器

 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];
于 2012-07-26T07:23:09.407 回答