企业信息

    北京沃赢科技有限公司

  • 12
  • 公司认证: 营业执照已认证
  • 企业性质:
    成立时间:
  • 公司地址: 北京市 海淀区 海淀街道 北京市海淀区银海大厦
  • 姓名: 刘老师
  • 认证: 手机未认证 身份证未认证 微信未绑定

    我赢职场IOS地图开发的介绍

  • 所属行业:商务服务 教育培训 管理培训
  • 发布日期:2015-07-28
  • 阅读量:161
  • 价格:面议
  • 产品规格:不限
  • 产品数量:10000.00 件
  • 包装说明:不限
  • 发货地址:北京海淀海淀  
  • 关键词:在线教育,我赢职场

    我赢职场IOS地图开发的介绍详细内容

    IOS地图开发
    
    简介
    IOS地图帮助我们定位位置,IOS地图使用 MapKit 框架。
    实例步骤
    1.创建一个简单的 View based application
    2.选择项目文件,然后选择目标,然后添加MapKit.framework.
    3.添加 Corelocation.framework
    4.向 ViewController.xib 添加地图查看和创建 ibOutlet 并且命名为mapView。
    5.通过"File-> New -> File... -> "选择 Objective C class创建一个新的文件,单击下一步
    6."sub class of"为 NSObject,类作命名为MapAnnotation
    7.选择创建
    8.更新MapAnnotation.h ,如下所示
    #import 
    #import 
    @interface MapAnnotation : NSObject
    @property (nonatomic, strong) NSString *title;
    @property (nonatomic, readwrite) CLLocationCoordinate2D coordinate;
    - (id)initWithTitle:(NSString *)title andCoordinate:
      (CLLocationCoordinate2D)coordinate2d;
    @end
    9.更新MapAnnotation.m ,如下所示
    #import "MapAnnotation.h"
    @implementation MapAnnotation
    -(id)initWithTitle:(NSString *)title andCoordinate:
     (CLLocationCoordinate2D)coordinate2d{
            self.title = title;
        self.coordinate =coordinate2d;
        return self;
    }
    @end
    10.更新ViewController.h ,如下所示
    #import 
    #import 
    #import 
    @interface ViewController : UIViewController{
        MKMapView *mapView;
    }
    @end
    11.更新ViewController.m ,如下所示
    #import "ViewController.h"
    #import "MapAnnotation.h"@interface ViewController ()
    @end
    @implementation ViewController
    - (void)viewDidLoad{
       [super viewDidLoad];
       mapView = [[MKMapView alloc]initWithFrame:
       CGRectMake(10, 100, 300, 300)];
       mapView.delegate = self;
       mapView.centerCoordinate = CLLocationCoordinate2DMake(37.32, -122.03);
       mapView.mapType = MKMapTypeHybrid;
       CLLocationCoordinate2D location;
       location.latitude = (double) 37.332768;
       location.longitude = (double) -122.030039;
       // Add the annotation to our map view
       MapAnnotation *newAnnotation = [[MapAnnotation alloc]
       initWithTitle:@"Apple Head quaters" andCoordinate:location];
       [mapView addAnnotation:newAnnotation];
       CLLocationCoordinate2D location2;
       location2.latitude = (double) 37.35239;
       location2.longitude = (double) -122.025919;
       MapAnnotation *newAnnotation2 = [[MapAnnotation alloc]
        initWithTitle:@"Test annotation" andCoordinate:location2];
       [mapView addAnnotation:newAnnotation2];
       [self.view addSubview:mapView];
    }
    // When a map annotation point is added, zoom to it (1500 range)
    - (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views{
       MKAnnotationView *annotationView = [views objectAtIndex:0];
       id  mp = [annotationView annotation];
       MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance
       ([mp coordinate], 1500, 1500);
       [mv setRegion:region animated:YES];
       [mv selectAnnotation:mp animated:YES];
    }
    - (void)didReceiveMemoryWarning{
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    @end
    
    
    学习链接/ios/?tg=5009295340
    学习交流群:317140762
    

    http://jiexiaotan.cn.b2b168.com
    欢迎来到北京沃赢科技有限公司网站, 具体地址是北京市海淀区海淀街道北京市海淀区银海大厦,联系人是刘老师。 主要经营iOS开发、互联网架构师、安卓、Oracle、SAP、RedHat等。 单位注册资金未知。 我们公司主要服务有:教育教学软件等,我们愿以优质的服务和诚意、为您提供精良的产品和专业枝术,共创美好未来!