【发布时间】:2012-11-13 02:34:16
【问题描述】:
我有一个对象列表,每个对象都有标题、名称、描述、纬度、经度和地址。 是否可以将此对象显示为 MKAnnotations?我已经坚持了几个小时了。当我试图使对象具有 CLLocationCoordinate2D 时,我不断收到关于纬度或经度不可分配的错误。
#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
因此,在使用互联网服务后,我得到了大约 70 个这样的对象。现在我希望能够将其中的每一个都变成地图注释。 这是我尝试分配纬度的方法之一,但我收到错误“表达式不可分配”..
currentOffice.oficinaCoordinate.latitude = [parseCharacters floatValue];
currentOffice 是我的自定义对象的一个实例。
【问题讨论】:
-
您可以发布自定义对象的代码吗?
-
有可能,我已经做到了,然后再给我看一下我的代码并给你看一个例子。
标签: ios mapkit mkannotation