首页 > 其他 > 详细

Creating a Map View

时间:2014-06-03 12:17:32      阅读:420      评论:0      收藏:0      [点我收藏+]

 

Problem

You want to instantiate and display a map on a view

Solution

Create an instance of the MKMapView class and add it to a view or assign it as a subview of your view controller that creates an instance

Of MKMapView and displays it full-screen on its view

 

#import "WSYViewController.h"

#import <MapKit/MapKit.h>

@interface WSYViewController ()

@property (nonatomic,strong)MKMapView * myMapView;

@end

 

@implementation WSYViewController

 

- (void)viewDidLoad

{

    [super viewDidLoad];

   

    self.view.backgroundColor = [UIColor whiteColor];

   

    self.myMapView = [[MKMapView alloc] initWithFrame:self.view.frame];

   

    //set the map type to satellite

   

    self.myMapView.mapType = MKMapTypeSatellite;

   

    self.myMapView.autoresizingMask =

    UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;

   

    //add it to our view

    [self.view addSubview:self.myMapView];

}

 

//this is a simple root view controller with a variable of type MKMapView.Later

// in the implementation of this view controller we will initalize the map and set its type to satellite like so

 

@end

bubuko.com,布布扣

 

Creating a Map View,布布扣,bubuko.com

Creating a Map View

原文:http://www.cnblogs.com/ios-mark/p/3759884.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!