1

私のマップコード:

if (latitude != [NSNull null] && longitude != [NSNull null])
    {
    location.latitude=[latitude doubleValue];
    location.longitude=[longitude doubleValue];
    MyAnnotationView *newannotation=[[MyAnnotationView alloc]initWithTitle:[NSString stringWithFormat:@"Bus-%d",h] latitude:location.latitude longitude:location.longitude];
    [self.myMap addAnnotation:newannotation];
    myMap.mapType=MKMapTypeStandard;
    [myMap setCenterCoordinate:location animated:YES];
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location,1000,1000);
    [myMap setRegion:region animated:YES];

    }

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{

location.latitude=newLocation.coordinate.latitude;
location.longitude=newLocation.coordinate.longitude;
MyAnnotationView *newannotation=[[MyAnnotationView alloc]initWithTitle:[NSString stringWithFormat:@"Bus-%d",h] latitude:location.latitude longitude:location.longitude];
[self.myMap addAnnotation:newannotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location,1000, 1000);
[myMap setRegion:region animated:YES];
[myMap setCenterCoordinate:newLocation.coordinate animated:YES];
}

mkannotationview.h

@implementation MyAnnotationView
@synthesize title,coordinate;
-(id)initWithTitle:(NSString *)newTitle latitude:(float)newLatitude longitude:(float)newLongitude
{

    if (self=[super init])

    {
        title=newTitle;
        coordinate.latitude=newLatitude;
        coordinate.longitude=newLongitude;

    }
    return  self;
}

そのタイトルのコールアウトを追加するにはどうすればよいですか? その注釈をクリックしても飛び出しません。クリックすると、次のスレッドエラーが発生します

EXC_BREAKPOINT(code=EXC_1386+BPT,subcode 0.0)
4

0 に答える 0