Tristan
Tristan

Reputation: 3068

iPhone Maps App 'Location Square'

In the iPhone Maps application, you get a sort of 'location square' when you tap the disclosure arrow on a dropped pin, like this:

enter image description here

I've seen a few other apps have this. How would I implement this? I haven't found anything specific in MapKit for this.

Upvotes: 1

Views: 209

Answers (2)

makdad
makdad

Reputation: 6450

Rog has the right idea with the map, I'll just add part he left out inre: the rounded corners (you've indicated in the comments that you're looking for that as well).

Rounded corners comes for free with a lot of UIView stuff. This is code we put on UITableViewCell items to get a similar effect:

cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.cornerRadius = 15.0f;
cell.imageView.layer.borderWidth = 1.0f;
cell.imageView.layer.borderColor = [[UIColor lightGrayColor] CGColor];

Upvotes: 1

Rog
Rog

Reputation: 18670

I've implemented something similar by simply passing the pin coordinates to the details view, creating an MKMapView with a CGFrame of your choice and adding a pin to it. Because the map is likely to be cached anyway (from the previous view) you will get it loaded straight away.

Upvotes: 2

Related Questions