iphone - How to add a drop shadow to an MKMapView without disabling clipsToBounds -


I have a problem when I try to add drop shadow to MKMapView layer, visible To be shadow I need to set the clip-to-bounce property to be false. However, doing this causes the map to pull the tile out of the viewing boundaries, overlapping the shadows And the reduction result in some parts of my idea looks like this:

I am thinking that What is a way to draw a drop shadow without disabling a clipping limit or otherwise drop shadow bug to appear without this ugly scene. My code looks like this for drop shadows:

  self.mapView.layer.borderWidth = 5.0; Self.mapView.layer.borderColor = [[UIColor whiteColor] CGColor]; Self.mapView.layer.shadowOffset = CGSizeMake (0.0, 0.0); Self.mapView.layer.shadowColor = [[UIColor blackColor] CGColor]; Self.mapView.layer.shadowRadius = 5.0; Self.mapView.layer.shadowOpacity = 0.2; Self.mapView.clipsToBounds = No;    

Because the layer is owned by MKMapView , this is common As such, it is not a great idea to touch yourself. (This is something that is likely to break oddly in subsequent OS versions, and behaves in unexpected ways (it would be interesting to see that this works also with the new iOS 6) 3D maps. With layer-backed scenes, you do not want to touch the layer directly at all (unless this layer is hosted, but this is different))

To get a shadow below, Just your Create yourself a new CALayer shade at the bottom of the map. Optionally nest MKMapView as a subview of your own UIView , and add the shadow to your view (it does not require clipping).

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -