user2154220
user2154220

Reputation: 83

UIView over UITableViewController

I need to place a UIView over UITableViewController, for now i placed it this way

[self.navigationController.view addSubview:searchView];

But problem is that - when i push this UITableViewController by another - my UIView is not pushed away with UITableViewController, but still hang up there, of course i just can remove it with animation, but it looks crapy enough

Is there a way to make that my UIView will be cover another VC together with UITableViewController?

Thanks!

Upvotes: 2

Views: 1175

Answers (2)

Kartik 123
Kartik 123

Reputation: 1032

You can't use [self.view addSubview:searchView] as in that case self.view is UITableview only so this will add the searchview on tableview and your view will also scroll with the tableview. You can use

[self.navigationController.view addSubview:searchView];

Upvotes: 1

Finn Gaida
Finn Gaida

Reputation: 4040

UITableViewControllers in fact also have a view property which you can add subviews to. So my advice would be to just send [self.view addSubview:searchView]; inside the table view controller, so that it will be moved alongside the table view, when pushing another controller.

Upvotes: 0

Related Questions