Chaaruu Jadhav
Chaaruu Jadhav

Reputation: 484

Open subview in tabbar controller

I am using storyboard and xib both & ios7.In bellow screenshot i used tab bar controller in storyboard but when i am trying to open next view controller(xib) on click of cell it's not opening in same view.I want to open that view on same view or tab.I tried too many ways but not working.Please help me to solve this issue.

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath 
   *)indexPath
{  
   FriendProfileViewController *FPVController = [[FriendProfileViewController  
   alloc]initWithNibName:@"FriendProfileViewController" bundle:nil];
   // [self presentViewController:FPVController animated:YES completion:nil];
  [self.navigationController pushViewController:FPVController animated:YES];
}

enter image description hereenter image description here

Upvotes: 0

Views: 77

Answers (1)

Lepidopteron
Lepidopteron

Reputation: 6165

You want to make use of the UINavigationController:

[self.navigationController pushViewController:FPVController animated:YES];

Did you also provide one in your storyboard? If there is no UINavigationController, this cannot push a new one :-) Your Storyboard could look like: enter image description here

To accomplish this, do the following: Drag and drop a UINavigationController into the storyboard. Rightclick and drag from your TabBarController onto the new UINavigationcontroller and select "viewControllers". Now rightclick and drag from your new UINavigationcontroller onto your UITableViewController and select "root". Afterwards delete the connection from the UITableViewController to the UITableViewController, because this will not be directly a viewcontroller of the tabbar, but rather indirect through the UINavigationController :-)

Upvotes: 1

Related Questions