У меня есть карта, которая извлекает из coredata и получает массив объектов местоположения. Расположение объектов пользовательских NSManagedObjects, которые выглядят так:Как передать объект MyLocation из Mapview в tableview?
@property (nonatomic, retain) NSString * ciudad;
@property (nonatomic, retain) NSString * horario;
@property (nonatomic, retain) NSString * codigo;
@property (nonatomic, retain) NSString * nombrePublico;
@property (nonatomic, retain) NSString * telefono;
@property (nonatomic, retain) NSString * direccion;
@property (nonatomic, retain) NSString * coordenadas;
@property (nonatomic, retain) NSString * hrs24;
@property (nonatomic, retain) NSString * driveThru;
@property (nonatomic, retain) NSDate * updatedAt;
Я тогда цикл через все объекты Место в массиве и создания аннотаций, как так:
MyLocation *annotation = [[MyLocation alloc] initWithName:storeDescription address:address coordinate:coordinate distance:0];
И я добавить эти аннотации массив, а затем нанести их одним нажатием кнопки:
- (IBAction)refreshTapped:(id)sender {
for (id<MKAnnotation> annotation in _mapView.annotations) {
[_mapView removeAnnotation:annotation];
}
for (MyLocation *annotation in self.myLocationsToSort) {
[_mapView addAnnotation:annotation];
}
}
Наконец, я хочу передать объект в UIViewController, как только пользователь нажмет кнопку раскрытия в выноске. Итак, сначала я создаю свою аннотацию:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
, то я сделаю это:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control{
if (![view.annotation isKindOfClass:[MyLocation class]])
return;
[self performSegueWithIdentifier:@"DetailVC" sender:view];
}
Segue называет деталь TableView. Мой вопрос: как я должен обрабатывать передачу объекта в виде таблицы деталей?