How to add NavigationBar (without NavigationController) and SearchBar to a
TableView
I get the feeling this really shouldn't be giving me as much trouble as it
is and that I'm missing something, but I just can't seem to get this to
work. So I want a TabBar that switches between 3 different TableViews. All
of them need to have a NavigationBar but not a NavigationController (as
it's all taking place after an initial modal segue into the
TabBarController). the perfect example of what I'm after is the Apple Maps
bookmarks.
I've tried three different methods all of which have failed in different
ways:
Add a TableView, then add a NavBar to this, then add the SearchBar. The
SearchBar simply replaces the NavBar.
Add a View, then add the NavBar to this. Then add the TableView as a
subView. When I add the SearchBar to this subView it ends up underneath
the prototype cell (didn't try running this as I would have to write a new
ViewController to handle the fact that the TableView is now a subview and
didn't think it was worth it just yet given the layout problems).
Add a View, then add a NavBar to this. then add a ContainerView which has
a TableViewController. This simply crashes on running. I'm not sure what
the error is here as I'm not really too sure where to catch any
exceptions...
I've implemented most of my interface in the IB so far and would like to
keep it that way as much as possible, but I'm sure there must be something
obvious I'm missing here. I've not been iOS programming for very long so
go easy on me if I'm missing something fundamental! Any help would be
appreciated greatly. Even if it's just saying which above approach I
should go with and keep trying at. Thanks!
No comments:
Post a Comment