Max Khan Max Khan - 1 year ago 51
iOS Question

Cannot present a View Through a UITableViewController

So I have a UITableViewController inside of a UIPageController inside of a UIViewController. I have an action for when a cell in the tableView is pressed, I present a custom view to the screen. However, this does not work when I say "self.navigationController?.view.addSubview(schedulePopUp)", or even when I call the method to bring the view to the front. Yes, I have read these kind of questions: questions, and no, they did not solve my problem. Any help would be great. Thanks.

Answer Source

I recently had this same problem and I never found an approach that worked with UITableViewController. No combo of adding subviews to various views, bringing to front, layout setting or order in interface builder did the trick.

I ended up just switching to a UITableView in a standard UIViewController. You just need to constrain the edges of the table to the view, implement the delegate/data source, connect a couple of outlets and your code can come over with minimal trivial changes.

Now I can bring views up in front of it, no problem. Behaves exactly the same from the user's point of view.