What is the technical name of the window/view that slides up with the 'directions' button when I touch a pin on my iPhone map?

158 Views Asked by At

I want to program a MapKit Annotation so that when a pin is touched on the screen a view that slides from the bottom of the screen comes up about 1/4 of the screen and offers the directions button along with description, photos, phone number, website and such. Just like it happens with the default iPhone maps application.

What is the name of this view that comes up from the bottom? And, are there any tutorials to program it for an app? It took me awhile to learn that the pins are actually named MKPointAnnotations on the iOS SDK, if someone can tell me what the name of this view is, or how to set it, that would be great.

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

it's called bottom sheet in Android, to mimic that same behaviour in iOS you can check this link

How can I mimic the bottom sheet from the Maps app?

I hope this will help you.

0
On

Approach 1:

It's a view, literally, just add your 1/4 view with the desired design.

Approach 2:

It can be a view controller, the main thing is how you present the new controller and it's background color. You have to present it with modalPresentationStyle = .overCurrentContext

let vc = <#YourViewController#>
vc.modalPresentationStyle = .overCurrentContext
self.present(vc, animated: true)

On presented view controller: self.view.backgroundColor = UIColor.clear, or any transparent color, and then you just add your 1/4 view with the desired design.

Note:

For handling moving the view as the user touches it, you can use UIPanGestureRecognizer

You will also want to animate it using UIView.animate, if you wanna do it without user interaction for some reason.