Minitour / AZTabBarController

A custom tab bar controller for iOS written in Swift 4.2
MIT License
348 stars 65 forks source link

Adding tableview as subview on top causes issue #20

Closed escully27 closed 7 years ago

escully27 commented 7 years ago

Hey! Me again :)

On one of the main views of the tabBarController, I am trying to instantiate another VC, add it as a subview, and animate it down onto the screen. This part is working fine, but when I scroll/tap or otherwise interact with this tableview (as a subview) its content disappears!

Let me know if this makes sense, otherwise I can inspect my code further. I've done this same thing many times and it works when not a descendant of the tabBarController.

Thanks again!!

Minitour commented 7 years ago

@escully27 Hi, Can you please show me how are you initializing the controller that has the table view, and how are you adding it to the tab bar controller?

escully27 commented 7 years ago

func filter(_ sender: Any) { let filter = self.storyboard?.instantiateViewController(withIdentifier: "feedFilter") as! feedFilter filter.view.frame = CGRect(x: 0, y: (0-self.view.frame.height)+280, width: self.view.frame.width, height: self.view.frame.height) filter.view.tag = 33 if let jw = currentTabBar?.parent { self.view.addSubview(filter.view) } }

Minitour commented 7 years ago

@escully27 So let me get this, You have a tab bar which holds x tabs, and in one of those tabs you have a selector function, that when called, it adds a view controller into that view controller.

So the current hierarchy is like this:

Well I don't think this has anything to do with the tab bar. Few things you might be missing is to add a child view controller to the Tab Bar Child View Controller, so that the Table View Controller is a child of it. I would also recommend adding constraints/auto resizing masks.

escully27 commented 7 years ago

Yes, you've got the layout correctly. I will continue to play with and let you know. Feel free to close for now, cheers