My Tab bar should stay on screen when I click on button in Test2 View Controller.

I've set Test 3 View Controller's Bottom bar to inferred and tried Translucent tab bar. I've changed the segue from push to modal. I've tried this solution, but doesn't work for iOS7.

TestTabBarController.m this doesn't work either:

- (void)viewDidLoad
{
    Test3ViewController * viewController1 = [[Test3ViewController alloc] initWithNibName:nil bundle:nil];
    UINavigationController *homeNavi=[[UINavigationController alloc]initWithRootViewController:viewController1];
    self.viewControllers = [NSArray arrayWithObjects:homeNavi, nil];    
}

This also doesn't work:

- (IBAction)buttonpress:(id)sender {      
   UIStoryboard *storyboard = [UIStoryboard   storyboardWithName:@"Main" bundle:nil];       
   Test3ViewController * test3ViewController = (Test3ViewController *)[storyboard instantiateViewControllerWithIdentifier:@"test3View"];     
   [self.navigationController pushViewController:test3ViewController animated:YES]; 
}

enter image description here

有帮助吗?

解决方案 3

The answer is: Add a Navigation controller between Test Tab Bar Controller and Test2 View Controller.

其他提示

First: Your link Test2 to Test3 in storyboard is Modal, change it to Push: enter image description here

And u'll see your navigation bar.

Second: Don't use the segue mechanism for your task. Use the pushViewController on UINavigationController

A modal view will cover the tab bar. If you want to load a view after you hit the 'Button' do the following:

- (IBAction) loadNewView:(id) sender {
    Test3ViewController * viewController1 = [[Test3ViewController alloc] initWithNibName:nil bundle:nil];
    [[self navigationController] pushViewController:viewController1 animated:YES];
}

Then link that up with your button...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top