使用MapKit iOS显示地图的特定区域
我对Mapkit IOS非常陌生。我正在创建的应用程序应该只显示特定的地区,如地图上的德国和其余地区应成为黑色,如所附图片所示 这是我现在所做的代码: ViewController.h使用MapKit iOS显示地图的特定区域,ios,objective-c,mapkit,ipod,Ios,Objective C,Mapkit,Ipod,我对Mapkit IOS非常陌生。我正在创建的应用程序应该只显示特定的地区,如地图上的德国和其余地区应成为黑色,如所附图片所示 这是我现在所做的代码: ViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface ViewController : UIViewController{ MKMapView *mapview; } - (IBAction)setMap:(id)
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface ViewController : UIViewController{
MKMapView *mapview;
}
- (IBAction)setMap:(id)sender;
@property (strong, nonatomic) IBOutlet MKMapView *mapview;
@end
上传代码您是如何实现的。Sachin请检查我上传的代码。我认为您没有正确设置约束。按照教程进行操作。我设置了一些限制条件,但效果很好……挑战是我需要在地图上显示特定的区域,比如印度,剩余区域应该变成黑色。这是我的目标。你能帮我怎么开始吗。。。像这样,你需要确定国家边界,画一条UIBeizerPath并用黑色涂色。
#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