Search code examples
iosobjective-cunity-game-engineuinavigationcontroller

Hide nav item from unity exported project : iOS


I have integrated unity in iOS and worked well. But there is unexpected nav bar item. How to hide that nav item or remove it so that I can show my top item.

Here is the image of that item:

enter image description here

I also don't know how he is getting that name. After deleting nav item from storyboard also the item is there but without any name. And here is the code:

@property (nonatomic, strong) UINavigationController *navigationController;



UIStoryboard *storyBoard;
    storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    _rootController         = [[UnityPortraitOnlyViewController alloc] init];
    _rootView               = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    _rootController.view    = _rootView;

    ViewController *mainVC       = [storyBoard instantiateViewControllerWithIdentifier:@"ViewController"];

    self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainVC];

    [_rootView addSubview:self.navigationController.view];

Solution

  • Try this :

    self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainVC];
    self.navigationController.navigationBarHidden = YES; 
    self.navigationController.navigationBar.translucent = NO;