开发者

Annotation Sub Class custom initWithCoordinate

I've subclassed MKAnnotation so that i can assign objects to each annotation, this is so that when the rightCalloutAccessoryView is clicked i can push a navigation co开发者_如何学Gontroller with the object passed to it and display the objects data in another view.

This all works great apart from one thing, i've extended upon initWithCoordinate like so:

-(id)initWithCoordinate:(CLLocationCoordinate2D)coord andObject:(NSManagedObject *)object {

    [self setPlace:object];

    coordinate = coord;
    title = [place valueForKey:@"name"];
    subtitle = [place valueForKey:@"address"];

    return self;

}

Although everything is working great i'm recieving the warning:

NO '-initWithCoordinate:andObject:' method found

Which means i'm doing something wrong somewhere, what is the correct way to go about adding upon initWithCoorinate?


Put the prototype -(id)initWithCoordinate:(CLLocationCoordinate2D)coord andObject:(NSManagedObject *)object in .h file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜