zoukankan      html  css  js  c++  java
  • IOS MapView 用法

    mapView use method

     1 。地图编程接口;

     2. 可规划的路线;

     3. 设置书签标记;

     4.周边查找服务。

    结构 表示 地图上一个点,一个矩形区域,一个大小。 

    手机位置服务,导航

    typedef struct

    {

      CLLocationDegrees latitudeDelta;

      CLLocationDegrees longitudeDelta; 

    } MKCoordinateSpan;

    typedef struct{

       CLLocationCoordinate2D center;

       MKCoordinateSpan span;

    }MKCoordinateRegion; 

    1 .h file

     //  Created by denny chen on 12-7-8.

    //  Copyright (c) 2012 __MyCompanyName__. All rights reserved.

    //


    #import <UIKit/UIKit.h>

    #import <MapKit/MapKit.h>


    @interface MapKitViewViewController : UIViewController

    {

        MKMapView *MKMapView;

    }

    @property (retain, nonatomic) IBOutlet MKMapView *mymapkit;


    2 .m file

    @implementation MapKitViewViewController

    @synthesize mymapkit;


    - (void)viewDidLoad

    {

        [super viewDidLoad];

        //set display jing wei du

    CLLocationCoordinate2D center;

        center.latitude=40.029915;

        center.longitude=116.347082;

        

        MKCoordinateSpan span;

        span.latitudeDelta=0.2;

        span.longitudeDelta=0.2;

        MKCoordinateRegion region={center,span};

        

        //set map center location

        [self.mymapkit setRegion:region];

    }


    - (void)viewDidUnload

    {

        [self setMymapkit:nil];

        [super viewDidUnload];

        // Release any retained subviews of the main view.

    }


    - (void)dealloc {

        [mymapkit release];

        [super dealloc];

    }

    3 create myAnnotation.h file

    #import <Foundation/Foundation.h>

    #import <MAPkit/Mapkit.h>


    @interface myAnnotation : NSObject <MKAnnotation>

        

    @end 

    4 create myAnnotation.m file

     #import "myAnnotation.h"


    @implementation myAnnotation


    -(CLLocationCoordinate2D) coordinate

    {

        CLLocationCoordinate2D center;

        center.latitude=40.029915;

        center.longitude=116.347082;

        return center;

    }


    -(NSString *) title

    {

      return @"北京大学";

    }


    -(NSString *) subtitle

    {

        return @"你所查寻的位置";

    }

    @end


    4 run reslut

     

  • 相关阅读:
    Airtest操作多台云手机,进行分发,多个脚本后端调度
    Airtest常见的元素定位不到
    pythonDES加密与解密以及hex输出和bs64格式输出
    adb命令将抓包工具证书从用户目录移动至系统目录,解决反爬对于本地证书认证
    解决appium每次app启动时候已登入账号会登出
    PHP数组循环遍历的几种方式
    TP5.1/TP框架的访问控制,访问不存在的模块、控制器、方法等控制
    PHP常用数组函数
    TP5截取部分字符串
    apache虚拟主机配置及解析
  • 原文地址:https://www.cnblogs.com/csj007523/p/2581720.html
Copyright © 2011-2022 走看看