码迷,mamicode.com
首页 > 其他好文 > 详细

Creating a Map View

时间:2014-06-03 12:19:39      阅读:314      评论:0      收藏:0      [点我收藏+]

标签:c   class   a   color   int   width   

 

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

标签:c   class   a   color   int   width   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!