Reputation: 77
I don't know the exact cause of this but I am guessing it has something to do with a container view controller being used. I am actually using several containers, one is for a SWRevealViewController
, which houses a generic UIViewController
for its rearViewController and a UINavigationController
for the frontViewController. The root view controller of this navigation controller is another container view controller, a MainViewController, which contains a UIPageViewController
. Page view controller has 3 UITableViewController
s and when I try to navigate from those table view controllers to the relevant view controllers (via a segue), and I want it to be a push transition, it makes a modal transition so what gives?
It is something to do with hierarchy I guess, but it is kinda messed up with all these view controllers right now and I think I broke my brain at some point. I would really appreciate if someone who knows what is wrong can explain.
Upvotes: 1
Views: 504
Reputation: 77
Thanks for the replies but I got it working without the use of segues and the storyboard, by pushing the view controller in tableView delegate manually, like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PlaceViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"placeViewController"];
vc.place = self.places[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}
Upvotes: 1
Reputation: 650
was stuck with the same problem and tried to solve for almost 2 days, and finally solved that..
View Hierarchy:
Container View
Solution
and when want to display any controller instead of presenting the controller itself present the UINavigationController, this will solve the problem of not happening segue push animation...
sample code, hoping it will help:
import UIKit
class ViewController: UIViewController {
var loginViewNavigation : UINavigationController!
var singupViewNavigation : UINavigationController!
override func viewDidLoad() {
super.viewDidLoad()
var storyBoard = UIStoryboard(name: "User", bundle: nil)
loginViewNavigation = storyBoard.instantiateViewControllerWithIdentifier("LoginViewNavigation") as! UINavigationController
singupViewNavigation = storyBoard.instantiateViewControllerWithIdentifier("SignupViewNavigation") as! UINavigationController
self.addChildViewController(loginViewNavigation)
self.addChildViewController(singupViewNavigation)
self.view.addSubview(loginViewNavigation.view)
}
}
Point to observe is the use the UINavigationController of the controller you want to display instead of that ViewController
Upvotes: 0