oc中的可变数组NSMutableArray里面只能存放object,对于结构体类型,必须进行转换才能放入可变数组
NSMutableArray *coordinateArray = [NSMutableArray array];
CLLocationCoordinate2D coor;
coor.latitude = item.latitude;
coor.longitude = item.longitude;
NSValue *value = [NSValue value:&coor withObjCType:@encode(CLLocationCoordinate2D)];
[coordinateArray addObject:value];
时间: 2024-10-06 07:33:22