我想知道如果有人能够帮助我。我是xcode的新手,我试图构建一个基本的应用程序。我按照这个教程Xcode6 IOS8 mapkit pins不显示
http://rshankar.com/how-to-add-annotation-to-mapview-in-ios/
我抄的源代码直接,我没有得到任何错误或警告,但在运行应用程序的引脚位置不显示的时候。我不知道他们是否在那里(只是看不见),或者他们根本没有出现。我似乎无法找到问题。
任何人都可以提出什么问题可以吗?
在此先感谢。
我想知道如果有人能够帮助我。我是xcode的新手,我试图构建一个基本的应用程序。我按照这个教程Xcode6 IOS8 mapkit pins不显示
http://rshankar.com/how-to-add-annotation-to-mapview-in-ios/
我抄的源代码直接,我没有得到任何错误或警告,但在运行应用程序的引脚位置不显示的时候。我不知道他们是否在那里(只是看不见),或者他们根本没有出现。我似乎无法找到问题。
任何人都可以提出什么问题可以吗?
在此先感谢。
实际上设法解决这个问题,原来坐标是错误的方式! Noob错误!如果有人可以在教程中更改代码的位置,我想更改引脚上的标注。 感谢
要更改引脚的标注:
<MKMapViewDelegate>
协议delegate
到类的类(如mapView.delegate = self;
)MKMapViewDelegate
的(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
方法小号omething这样的:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
// If it's the user location, just return nil
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
// Handle custom annotations
if ([annotation isKindOfClass:[NAME_OF_CLASS_IMPLEMENTING_MKANNOTATION_PROTOCOL class]])
{
// Try to dequeue an existing annotation view first
MKAnnotationView *annotationView = (MKAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:@"AnnotationViewIdentifier"];
if (!annotationView)
{
// If an existing pin view was not available, create one
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"AnnotationViewIdentifier"];
annotationView.canShowCallout = YES;
// set callout
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.rightCalloutAccessoryView = rightButton;
}
else
{
annotationView.annotation = annotation;
}
return annotationView;
}
return nil;
}
在地图管脚(这应该从实现MKAnnotation
协议的类进行),你应该能够设置title
和subtitle
性能。