방금 새 앱을 만들었고보기에지도를 구현했습니다. 일부 개인 주석을 사용하여지도를 만들었지 만 사용자가 핀을 터치해도 아무 것도 나타나지 않습니다. 핀의 색상을 설정하려고했지만 아무 것도 작동하지 않는 것 같습니다. 핀을 만졌을 때 사용자가 팝업의 공개 버튼을 터치하여 "기본지도"를 사용할 수 있어야합니다. 이제 핀을 만지면이 부분이 어두워 지지만 그 밖의 것은 없습니다. 누군가 나를 도울 수 있습니까? 부디!!팝업이없는 핀으로 된 Mapkit 새로운 주석
멀리서는 공개되지 않았으며, 멀리는 응용 프로그램이 없습니다. 그 녀석은 녀석이 아니야! 비 응급 처치법에 따라 비 응급 처치법을 배우십시오.
헤더 서브
#import <Foundation/Foundation.h>
#import <MapKit/Mapkit.h>
@interface myAnnotation : NSObject <MKAnnotation>{
CLLocationCoordinate2D coordinate;
NSString *titolo;
NSString *sottotitolo;
}
@property(nonatomic,assign) CLLocationCoordinate2D coordinate;
@property(nonatomic,copy) NSString *titolo;
@property(nonatomic,copy) NSString *sottotitolo;
@end
구현 서브 다음
@implementation myAnnotation
@synthesize titolo;
@synthesize sottotitolo;
@synthesize coordinate;
-init{
return self;
}
@end
파일하는 .m 뷰 컨트롤러
CLLocation *userLoc = myMapView.userLocation.location;
CLLocationCoordinate2D userCoordinate = userLoc.coordinate;
NSLog(@"user latitude = %f",userCoordinate.latitude);
NSLog(@"user longitude = %f",userCoordinate.longitude);
myMapView.delegate=self;
NSMutableArray* annotations=[[NSMutableArray alloc] init];
CLLocationCoordinate2D theCoordinate1;
theCoordinate1.latitude = 45.;
theCoordinate1.longitude = 7.;
CLLocationCoordinate2D theCoordinate2;
theCoordinate2.latitude = 45.;
theCoordinate2.longitude = 12.;
CLLocationCoordinate2D theCoordinate3;
theCoordinate3.latitude = 45.;
theCoordinate3.longitude = 8.;
CLLocationCoordinate2D theCoordinate4;
theCoordinate4.latitude = 43.;
theCoordinate4.longitude = 7.;
myAnnotation* myAnnotation1=[[myAnnotation alloc] init];
myAnnotation1.coordinate=theCoordinate1;
[email protected]"xxxx";
[email protected]"xxx";
myAnnotation* myAnnotation2=[[myAnnotation alloc] init];
myAnnotation2.coordinate=theCoordinate2;
[email protected]"yyyy";
[email protected]"yyyy";
myAnnotation* myAnnotation3=[[myAnnotation alloc] init];
myAnnotation3.coordinate=theCoordinate3;
[email protected]"zzz";
[email protected]"zzz";
myAnnotation* myAnnotation4=[[myAnnotation alloc] init];
myAnnotation4.coordinate=theCoordinate4;
[email protected]"kkk";
[email protected]"kkk";
[myMapView addAnnotation:myAnnotation1];
[myMapView addAnnotation:myAnnotation2];
[myMapView addAnnotation:myAnnotation3];
[myMapView addAnnotation:myAnnotation4];
[annotations addObject:myAnnotation1];
[annotations addObject:myAnnotation2];
[annotations addObject:myAnnotation3];
[annotations addObject:myAnnotation4];
NSLog(@"%d",[annotations count]);
및 핀
표시 및 개인화 니펫
감사합니다. Anna Karenina! 문제를 해결했습니다! :) – TheInterestedOne