Showing a MKAnnotation for custom object

Posted by Chamanhm on Stack Overflow See other posts from Stack Overflow or by Chamanhm
Published on 2012-11-13T02:34:16Z Indexed on 2012/11/13 5:00 UTC
Read the original article Hit count: 174

Filed under:
|
|

I have a list of objects and each of those has a title, name, description, latitude, longitude and address. Is it possible to show this objects as MKAnnotations? I've been stuck with this for hours now. When I tried to make the objects have a CLLocationCoordinate2D I kept getting the error about latitude or longitude not being assignable.

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface Oficina : NSObject <MKMapViewDelegate>

@property (nonatomic, readwrite) CLLocationCoordinate2D oficinaCoordinate;
@property (nonatomic, strong) NSString *oficinaCiudad;
@property (nonatomic, strong) NSString *oficinaEstado;
@property (nonatomic, strong) NSString *oficinaTitulo;
@property (nonatomic, strong) NSString *oficinaTelefono;
@property (nonatomic, strong) NSString *oficinaLatitud;
@property (nonatomic, strong) NSString *oficinaLongitud;
@property (nonatomic, strong) NSString *oficinaID;
@property (nonatomic, strong) NSString *oficinaDireccion;
@property (nonatomic, strong) NSString *oficinaHorario;
@property (nonatomic, strong) NSString *oficinaTipoDeOficina;
@property (nonatomic, strong) NSString *oficinaServicios;
@property (nonatomic, strong) NSString *oficinaTipoDeModulo;


@end

So after consuming an internet service I get around 70 of these objects. Now I want to be able to turn each of those into a map annotation. This is one of the ways I've tried to assign the latitude but I get the error "Expression not assignable"..

currentOffice.oficinaCoordinate.latitude = [parseCharacters floatValue];

Where currentOffice is an instance of my custom object.

© Stack Overflow or respective owner

Related posts about ios

Related posts about mapkit