views:

19

answers:

1

I have a custom UITableViewCell set up with a MKMapView set up within the cell. I would like the map to take up all of the cell and so I have set the Map View to have the same dimensions as the TableCell.

The application is working ok, but the square corners on the Map View extend beyond the bounds of the table cell. Is there a way to mask the corners of the Map View so it fits the table cell perfectly? I think I have seen this in other applications.

Here is the code used, but it doesn't really reveal much as most of the set up is done using IB.

[cell.mapView setMapType:MKMapTypeStandard];
cell.mapView.bounds = cell.frame;
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; 
region.center.latitude = myLat ;
region.center.longitude = myLong;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[cell.mapView setRegion:region animated:YES];

Thanks

+2  A: 

Try setting the cornerRadius of the mapView's layer:

#import <QuartzCore/QuartzCore.h>
:
:
mapView.layer.cornerRadius = 8;

This will round all four corners though. If you only need top or bottom corners rounded, you could fudge the mapView's position in the cell so the top or bottom corners are not visible.

aBitObvious
Perfect, worked a charm thanks!
KSoza