废话不说,直接上代码
//
// CommunityTool.h
// SmartCommunity
//
// Created by chenhuan on 15/9/2.
// Copyright (c) 2015年 smartcommunity. All rights reserved.
// #import <Foundation/Foundation.h>
@interface CommunityTool : NSObject
+ (void)SaveComunity:(NSArray *)homepageBeans;
+ (NSMutableArray *)HomePageBean;
@end
//
// CommunityTool.m
// SmartCommunity
//
// Created by chenhuan on 15/9/2.
// Copyright (c) 2015年 smartcommunity. All rights reserved.
// #import "CommunityTool.h" #define SChomepagePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"homepage.archive"] @implementation CommunityTool
+ (void)SaveComunity:(NSArray *)homepageBeans{
[NSKeyedArchiver archiveRootObject:homepageBeans toFile:SChomepagePath];
}
+ (NSMutableArray *)HomePageBean{
return [NSKeyedUnarchiver unarchiveObjectWithFile:SChomepagePath];
}
@end