2

I'm trying manipulate with Google places and autocomplete, about autocomplete from Google places I got the results but I wish put the results in a search bar with table view in front of Google maps, like a pop up. But I just found examples with search bar and table view and anything more behind them. I'm looking foward do something like the image below.

Example about pop up with table view in front of maps

Any help would be appreciated.

  • I believe that tableView that only lakes up part of the screen is presented as a popover (this is a certain type of segue). You have to create a viewController or tableViewController and present is as a popover. Popovers only work on iPads, so if it's not an iPad, it will present modally. I would check out videos on youtube on how to present a popover like this one: https://www.youtube.com/watch?v=48UA06EwfrM – Dan Levy Apr 10 '16 at 18:09
  • Oh, thanks. I see something like that in Iphone, the propose is doing in Iphone though, I just show a pic in Ipad because is more clear to see what I would like to do. In Iphone the Table view called by search bar been in front of map in little transparence way, but I didn't know the name of the action like popover. I will search about that. I appreciate the attention and if you have another advice I would like to see that. – Claudio Djohnnatha Apr 10 '16 at 18:28
  • Are you saying that on an iPhone, when you tap on the search bar, you want a tableView to appear over the content already displayed on the screen? That is possible on the iPhone! It just won't show up as part of the screen, the tableView will appear on the entire screen until the user hits cancel or a tableView cell. – Dan Levy Apr 10 '16 at 18:31
  • Yeah is it. I would like to tableView appear over the content, because I just saw examples with TableView and Search bar and filter in them. I wanted show a table view in front of maps when you tap on the search bar. – Claudio Djohnnatha Apr 10 '16 at 18:36
  • I know there is a video on YouTube but I couldn't find it. I would try looking around for something like "display tableView when search bar is tapped" – Dan Levy Apr 10 '16 at 19:15
  • Display a table view controller inside a container placed inside your main view controller – cyril Apr 10 '16 at 19:20

2 Answers2

0

NOTE: I have never personally done this, but here's my theory:

The UISearchBar is a nifty tool in that you can hook a delegate up to it to control its actions. Below is a screenshot of the documentation which can be found here: link.

screenshot

So, what I would do is to set the UISearchBar's to whatever it's surrounding class is. Then, implement your delegate methods so that when any of those methods shown above in the picture are called, the surrounding class will segue to a UIPopoverPresentationController, which in turn will have a UITableView within it. (The popover will literally "pop over" the rest of the screen.)

You will have to make sure that the class you have set as the delegate implements the UISearchBarDelegate protocol. It will look something like this:

class Foo: UISearchBarDelegate {
    /* stuff */
}

After that, all the data configuration is up to you. Again, this is all in theory as I haven't actually implemented this myself. If I got anything wrong, please tell me.

Good luck.

EDIT: To respond to Dan L's comment on the initial question, it is actually is possible to have a popover present without going modal on an iPhone (or any compact screen). You have to set the presenting class as the delegate of the UIPopoverPresentationController an then implement a delegate method like this:

func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle {
    return UIModalPresentationStyle.None
}

All the code is doing is preventing the popover from going modal ever.

jake
  • 124
  • 1
  • 10
0

The thing that I was looking for it was the popover. I would like to use a popover as I mentioned before, I found out some solutions similar here:

Community
  • 1
  • 1