Display specific area of map using MapKit iOS

132 views Asked by At

I am very new to Mapkit IOS. I am creating application that should display only specific region like Germany on map and remaining area should become black as seen in the picture attached.

Expecting Output

This is the code which I did as of now:

ViewController.h

 #import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface ViewController : UIViewController{
MKMapView *mapview;

}

- (IBAction)setMap:(id)sender;
@property (strong, nonatomic) IBOutlet MKMapView *mapview;

@end

ViewController.m

#import "ViewController.h"

@interface ViewController ()
@end

@implementation ViewController

@synthesize mapview = _mapview;

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a       nib.
}


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}


- (IBAction)setMap:(id)sender {

switch (((UISegmentedControl *)sender).selectedSegmentIndex) {
    case 0:
        _mapview.mapType = MKMapTypeStandard;

        break;
    case 1:
        _mapview.mapType = MKMapTypeSatellite;
        break;
    case 2:
        _mapview.mapType = MKMapTypeHybrid;
        break;

    default:
        break;
  }

}
@end
0

There are 0 answers