使用MapKit框架

使用MapKit框架(持续更新)

 

 

地图显示

最简单显示地图的代码:

//
//  RootViewController.m
//  CoreLocation
//
//  Copyright (c) 2014年 Y.X. All rights reserved.
//

#import "RootViewController.h"
#import <MapKit/MapKit.h>

@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    // 初始化地图控件
    MKMapView *mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
    
    // 地图的类型
    mapView.mapType = MKMapTypeStandard;
    
    // 视图的宽度和高度将和父视图的宽度一起成比例变化
    mapView.autoresizingMask = \
        UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    
    // 显示地图
    [self.view addSubview:mapView];
}

@end
RootViewController

相关文章:

  • 2021-12-31
  • 2021-12-06
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
猜你喜欢
  • 2021-04-24
  • 2021-09-09
  • 2022-12-23
  • 2021-12-02
  • 2021-08-07
  • 2021-06-28
  • 2022-12-23
相关资源
相似解决方案