标签: mapkit

MKMapKit关注用户

我怎样才能让MKMapView我的用户跟随他们滚动,然后再按一下按钮来关注用户?

这是我希望它拥有的流程.

查看负载: 放大并以用户当前位置为中心,然后关注用户.

用户滚动: 在按下按钮之前不执行任何操作

按下按钮: 与"查看负载"相同的代码

iphone objective-c mapkit ios

0
推荐指数
1
解决办法
1249
查看次数

如何识别敲击了哪个引脚

MKMapView在这张地图上找到了一个带有大量针脚的应用程序.

每个针都得到了rightCalloutAccessoryView.我用这种方式创建它:

UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
pinView.rightCalloutAccessoryView = rightButton;
Run Code Online (Sandbox Code Playgroud)

我怎么知道,哪个引脚被敲了?日Thnx

xcode mapkit mkannotation mkannotationview ios

0
推荐指数
1
解决办法
4032
查看次数

获取谷歌地图的图像

我正在尝试获取一张谷歌地图的快照.但是,mapkit似乎没有类似的功能.有没有办法在不违反Google协议的情况下获取谷歌地图的一部分图像文件?

PS拍摄iphone的屏幕截图不是一个选项,因为我可能需要一个主要在屏幕外的部分的快照.

iphone cocoa-touch google-maps objective-c mapkit

0
推荐指数
1
解决办法
1502
查看次数

MapKit addAnnotations:无效

我有代码:

if (self.annotations) [self.mapView addAnnotations:self.mapView.annotations];
NSLog(@"mapView: %@, anos:%@",self.mapView,self.mapView.annotations);
Run Code Online (Sandbox Code Playgroud)

我得到下一个输出格式日志:

2012-04-26 14:35:53.823 FlickrClient[46441:11603] mapView: <MKMapView: 0x79c8b50; frame = (0 0; 320 367); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x79c62b0>>, anos:(
)
Run Code Online (Sandbox Code Playgroud)

所以据我所知,注释没有添加mapView 到此代码之前,我有下一个日志记录的东西:

for (id i in self.annotations)
{
    NSLog(@"%@, %i",i,[i conformsToProtocol:@protocol(MKAnnotation)]);
}
Run Code Online (Sandbox Code Playgroud)

它给出了:

...
2012-04-26 14:35:53.766 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a590>, 1
2012-04-26 14:35:53.767 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5a0>, 1
2012-04-26 14:35:53.767 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5b0>, 1
2012-04-26 14:35:53.819 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5c0>, 1
2012-04-26 14:35:53.819 FlickrClient[46441:11603] <TopPlaceAnnotation: 0x6d8a5d0>, 1
2012-04-26 14:35:53.819 …
Run Code Online (Sandbox Code Playgroud)

iphone mapkit ipad ios ios5

0
推荐指数
1
解决办法
796
查看次数

MKMapview不会在模拟器中显示iOS-7.0中的地图

我在我的应用程序中使用MKMapView.我需要在地图上显示当前位置.当我在iOS 6.0或6.1上显示它时,它工作正常.
在iOS 7.0上,Map无法正常显示.

看看iOS 7.0中的地图 -

在此输入图像描述


任何人都可以建议为什么地图的背景没有出现在这里,是否有任何额外的方法形成iOS 6.0,我们将不得不执行在iOS-7.0模拟器中显示地图?

iphone mapkit mkmapview ios

0
推荐指数
1
解决办法
3250
查看次数

使用故事板将数据从注释传递到详细视图iOS

我正在尝试通过Google Places API将我当前加载到注释中的数据传递到我通过带有segue的故事板创建的详细视图控制器中.

我在单击每个注释上的详细信息披露时正确加载了详细视图控制器,但我正在尝试获取现在传递的数据.

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
// Assuming I call the MapPoint class here and set it to the current annotation 
// then I'm able to call each property from the MapPoint class but wouldn't 
 // I have to set this in the prepareForSegue  but that would be out of scope?

    MapPoint *annView = view.annotation;

   //   annView.name
    // annView.address

    [self performSegueWithIdentifier:@"showBarDetails" sender:view];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([[segue identifier] isEqualToString:@"showBarDetails"])
    {
        BarDetailViewController *bdvc = …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c mapkit ios uistoryboardsegue

0
推荐指数
1
解决办法
1781
查看次数

如何在Swift中的两点之间绘制路径(注释)?

我想问一下是否有人可以帮我一些代码...我不知道如何在我的地图中创建一个Swift中的路线.我可以在两个注释之间画一条折线但是它走出了道路.如何在地图上连接两个注释?但是在路上连接它们......所有这些都是为了公共汽车之旅.有人帮我在Swift中向我展示了这个代码吗?

iphone mapkit ios swift

0
推荐指数
1
解决办法
2925
查看次数

如何通过Objective-C添加自定义图像以替换iOS MKMapView中的默认引脚?

到目前为止,我只有默认的MKMapView引脚工作.但我想要一个自定义图像来取代那个小红色别针.这就是我在下面的内容.我错过了什么?我想定义view.image会做的伎俩,但我猜不是.

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:   
  (id<MKAnnotation>)annotation {
    MKPinAnnotationView *view = [[MKPinAnnotationView alloc]  
    initWithAnnotation:annotation reuseIdentifier:@"pin"];
    view.enabled = YES;
    view.animatesDrop = YES;
    view.canShowCallout = YES;
    view.image = [UIImage imageNamed:@"custom-pin-image.png"];

    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage         
     imageNamed:@"custom-image-for-annotation.png"]];
    view.leftCalloutAccessoryView = imageView;
    view.rightCalloutAccessoryView = [UIButton buttonWithType:  
     UIButtonTypeDetailDisclosure];

    return view;
}
Run Code Online (Sandbox Code Playgroud)

objective-c mapkit ios

0
推荐指数
1
解决办法
2030
查看次数

如何在相同的注释视图下更改mapkit中的引脚颜色(swift3)

我在mapkit中有2个引脚,两个都在相同的注释视图下,所以它使得两个引脚都是相同的颜色.如何使引脚具有不同的颜色.我想你好红色和hellox是蓝色的.

import UIKit
import MapKit

class ViewController: UIViewController, MKMapViewDelegate {

@IBOutlet var jmap: MKMapView!

override func viewDidLoad() {
    jmap.delegate = self;
    let hello = MKPointAnnotation()
    hello.coordinate = CLLocationCoordinate2D(latitude: 40, longitude: -73)
    jmap.addAnnotation(hello)
    let hellox = MKPointAnnotation()
    hellox.coordinate = CLLocationCoordinate2D(latitude: 34, longitude: -72)
    jmap.addAnnotation(hellox)
}

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
    let annotationView = MKPinAnnotationView()
    annotationView.pinTintColor = .blue
    return annotationView
}}
Run Code Online (Sandbox Code Playgroud)

mapkit mkannotationview ios swift swift3

0
推荐指数
1
解决办法
4579
查看次数

为什么不调用MKMapView中的clusterAnnotationForMemberAnnotations?

我有一个简单的地图视图:

@IBOutlet private var mapView: MKMapView!
Run Code Online (Sandbox Code Playgroud)

然后我一个接一个地添加注释:

mapView.addAnnotation(Annotation(user: user))
Run Code Online (Sandbox Code Playgroud)

并向他们展示:

mapView.showAnnotations(mapView.annotations, animated: true)
Run Code Online (Sandbox Code Playgroud)

我也实现了这个方法:

func mapView(_ mapView: MKMapView, clusterAnnotationForMemberAnnotations memberAnnotations: [MKAnnotation]) -> MKClusterAnnotation {
    print(memberAnnotations)
    return MKClusterAnnotation(memberAnnotations: memberAnnotations)
}
Run Code Online (Sandbox Code Playgroud)

但这根本不被召唤.为什么?

在此输入图像描述 在此输入图像描述

mapkit ios swift

0
推荐指数
1
解决办法
1765
查看次数