ios 跳转到地图指定位置

来源:互联网 发布:腾讯数据库占地 编辑:程序博客网 时间:2024/04/27 20:06

先声明一个button 叫 myBtn

myBtn = [[UIButton alloc]initWithFrame:CGRectMake(50, 50, 100, 50)];    myBtn.backgroundColor = [UIColor grayColor];    [myBtn addTarget:self action:@selector(myButtonPressed:) forControlEvents:UIControlEventTouchUpInside];    [self.view addSubview:myBtn];

myButtonPressed函数

- (void) myButtonPressed:(id)sender{        CLLocationCoordinate2D myDst = CLLocationCoordinate2DMake(39.0, 121.0);    MKMapItem *dstLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:myDst addressDictionary:nil]];    dstLocation.name = @"大连理工大学软件学院";    [MKMapItem openMapsWithItems:@[dstLocation] launchOptions:@{MKLaunchOptionsMapCenterKey:[NSNumber numberWithBool:YES]}];

跳转到 39.0,121.0了 好像这是在海里但是

0 0