English 中文(简体)
Mapkit used in a grouped table cell and extends the rounded corners
原标题:

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

最佳回答

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.

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签