设置:有一个UITableView
显示美国高尔夫球场的名称、街道、州等。
UITableView's
数据源是NSMutableArray
我班级中的一个对象,GolfCourse
名为allGolfCourses
.
现在我想删除所有西海岸高尔夫球场allGolfCourses
并创建一个新的array
名为eastCoastGolfCourses
. 我有另一个NSArray
与string objects
所有西海岸州(缩写)有关,westCoastStates
但很难将这两者联系起来。
如何遍历 allGolfCourses 并删除在 westCoastStates
数组中找到状态缩写的所有对象?
westCoastStates 数组:
self.westCoastStates = [NSMutableArray arrayWithObjects:
@"CH",
@"OR",
@"WA",
nil];
高尔夫球场.h
@interface GolfCourse : NSObject
@property (nonatomic, strong) NSString *longitude;
@property (nonatomic, strong) NSString *latitude;
@property (nonatomic, strong) NSString *clubName;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *courseInfo;
@property (nonatomic, strong) NSString *street;
@property (nonatomic, strong) NSString *city;
@property (nonatomic, strong) NSString *clubID;
@property (nonatomic, strong) NSString *phone;
@end
注意:NSString *state; 包含州缩写,例如:FL
我知道如何使用单个参数来执行此操作,但不知道如何检查westCoastStates
数组中的所有字符串。希望你能帮忙。