<分区>
我有 TableViewController 和 ViewController。
机场.h
@interface Airports : UITableViewController
@property(strong, nonatomic) NSNumber* latitude;
@property(strong, nonatomic) NSNumber* longitude;
@property(strong, nonatomic) NSString* selectedAirportName;
@end
Airports.m
这是一个设置纬度、经度和selectedAirportName属性的实例。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSArray *airportNames = airportsArray[indexPath.row];
self.selectedAirportName = [airportNames valueForKey:@"$"];
NSArray *airportCoordinates = airportsCoordinates[indexPath.row];
self.latitude = [airportCoordinates valueForKey:@"Latitude"];
self.longitude = [airportCoordinates valueForKey:@"Longitude"];
}
行选择将用户转发到 ViewController,其中我有一个实例,根据所选行中的信息显示带有标记的 GoogleMap。如何让该实例访问 Airports 类的 latitude、longitude 和 selectedAirportName 属性?实际上,我想知道如何在 didSelectRowAtIndexPath 实例和 Airports 类之外公开这些属性以与它们一起操作。
我只是个初学者。所以不要开枪:)