欢迎访问易网站(www.yiwz.com)
易网站,供求信息免费发布平台
您当前位置是:产品大全 >> 商务服务 >> 其他教育培训
IOS地图开发 IOS地图开发//IOS地图开发

浏览大图
公 司: 我赢职场 
发布时间:2015年07月31日
留言询价 加为商友
  联系信息 企业信息
女士 (公司职员)
联系时,请说是在企业录看到的,谢谢!
电  话: 010-82168774-8005
传  真:
手  机:
地  址: 中国北京海淀区北京市海淀区银海大厦
邮  编: 100000
公司主页: http://1350225154.yiwz.com(加入收藏)
公 司:我赢职场

查看该公司详细资料

详细说明

    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 <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface MapAnnotation : NSObject<MKAnnotation>
@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 <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
@interface ViewController : UIViewController<MKMapViewDelegate>{
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 <MKAnnotation> 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


免责声明:以上所展示的信息由会员自行提供,内容的真实性、准确性和合法性由发布会员负责,www.qy6.com对此不承担任何责任。如有侵犯您的权益,请来信通知删除。
该公司其他产品信息
 1 直接到第
20 条信息,当前显示第 1 - 20 条,共 1

商务 广告 展会 维修 回收 生活 机械 仪器 五金 电子 电工 照明 汽配 交运 包装 印刷 安全 环保 化工 精化 橡塑 纺织 冶金 农业 健康 建筑 能源 服装 礼品 家居 数码 家电 通讯 办公 运动 食品 玩具 | 1 2 3 4 5 6 7 ..