好的我有1个表视图,1个详细视图和1个地图视图, 目标是使地图具有取决于所选单元格的特定坐标。 我试图使用相同的方法我在详细视图中更改文本,但它似乎没有工作。 好的,这里是代码...
tableview .m
latitude = [[NSArray alloc] initWithObjects:[NSNumber numberWithDouble:52.52314],[NSNumber numberWithDouble:52.52314],[NSNumber numberWithDouble:52.52314],[NSNumber numberWithDouble:52.52314],nil];
longitude = [[NSArray alloc] initWithObjects:[NSNumber numberWithDouble:-1.884799],[NSNumber numberWithDouble:-18.884799],[NSNumber numberWithDouble:-1.884799],[NSNumber numberWithDouble:-1.884799], nil];
[self.mapController changeLat:[latitude objectAtIndex:indexPath.row]];
[self.mapController changeLong:[longitude objectAtIndex:indexPath.row]];
mapView .m
- (IBAction) changeLat:(NSNumber *)str {
lati = str;
}
- (IBAction) changeLong:(NSNumber *)str {
longi = str;
}
MKCoordinateRegion region = {{0.0, 0.0}, {0.0, 0.0}};
region.center.latitude = [lati doubleValue];
region.center.longitude = [longi doubleValue];
[mapView setRegion:region animated:YES];
我真的坚持了下来:S