//
+ (NSString *) cretableName
{
,,NSArray *路径=NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask,是的);
,,NSString * documentPath=(路径,objectAtIndex: 0);
指定新建文件夹路径
,,NSString * p_w_picpathDocPath=[documentPath stringByAppendingPathComponent: [NSString stringWithFormat: @“setPlace.plist”]],
,,返回p_w_picpathDocPath;
}
//
+ (void) addPlaceWrite: (NSDictionary *) dict anCity: (NSString *) cityName
{
,NSString * filePath=[自我cretableName];
,,称为unaryoperations * dic=(称为unaryoperations dictionaryWithContentsOfFile: filePath];
,,如果(nil==dic)
,,{
,,,,dic=(称为unaryoperations dictionaryWithCapacity: 0];
,,}
,,NSMutableArray * dataArry=[dic valueForKey: cityName];
,,如果(nil==dataArry)
,,{
,,,,dataArry=[NSMutableArray arrayWithCapacity: 0];
,,}
,,如果(0,==dataArry.count)
,,{
,,,,[dataArry addObject: dict];
,,}
,,其他
,,{
,,,,[dataArry addObject: dict];
,,}
,,[dic setValue: dataArry forKey: cityName];
,,[dic writeToFile: filePath自动:是的),
}
//
+ (NSArray *) allPlaceData: (NSString *) cityName
{
,,NSString * filePath=[自我cretableName];
,,NSDictionary * dict=[NSDictionary dictionaryWithContentsOfFile: filePath];
,,NSArray * aray=dict [cityName];
,,返回aray;
}
//
+ (void) deletePlaceData: (NSInteger)指数anCity: (NSString *) cityName
{
,,NSString * filePath=[自我cretableName];
,,NSDictionary * dict=[NSDictionary dictionaryWithContentsOfFile: filePath];
,,NSMutableArray=dict(某个);*进行
,,[进行removeObjectAtIndex:指数);
,,[forKey dict setValue:进行:cityName];
,,[dict writeToFile: filePath自动:是的),
}
//
+ (void) modifyPlaceData: (NSDictionary *) dic anPlace: (NSInteger)指数anCity: (NSString *) cityName
{
,,NSString * filePath=[自我cretableName];
,,NSDictionary * dict=[NSDictionary dictionaryWithContentsOfFile: filePath];
,,NSMutableArray=dict(某个);*进行
,,,[进行removeObjectAtIndex:指数);
,,[进行insertObject: dic atIndex:指数];
,,[forKey dict setValue:进行:cityName];
,,[dict writeToFile: filePath自动:是的),
}
//
+ (BOOL) allCity: (NSString *) anCity
{
,,BOOL isBlean=没有;
,,NSString * filePath=[自我cretableCityName];
,,NSArray *进行=[NSArray arrayWithContentsOfFile: filePath];
,,(NSString *城市进行)
,,{
,,,如果([anCity isEqualToString:城市])
,,,{
,,,,,isBlean=是的,
,,,,,打破;
,,,}
,,}
,,返回isBlean;
}