How to programmatically change the color of a card from day to night in ios7

I am working on an application for iOS 7 and am trying to change the map from day-night and night. For this, I did not find the corresponding APIs in the iOS 7 documentation.

+6
source share
1 answer

This is not a built-in MKMapKit function, so what you ask for is impossible without it. If you did this yourself, it would be best to find the source of the "night mode" map fragment and use the MKTileOverlay class (New to iOS 7) to completely replace the contents of the map,

Short Code Example Using an Open Street Map Tile Source (Not Night Tiles!)

 // Put this in your -viewDidLoad method NSString *template = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png"; MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template]; //This is the important bit, it tells your map to replace ALL the content, not just overlay the tiles. overlay.canReplaceMapContent = YES; [self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels]; 

Then we implement the mapView delegate mapView below ...

 - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay { if ([overlay isKindOfClass:[MKTileOverlay class]]) { return [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay]; } } 

See the full link at https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKTileOverlay_class/Reference/Reference.html

+2
source

All Articles