标签:
废话不说,直接上代码
1 // 2 // CommunityTool.h 3 // SmartCommunity 4 // 5 // Created by chenhuan on 15/9/2. 6 // Copyright (c) 2015年 smartcommunity. All rights reserved. 7 // 8 9 #import <Foundation/Foundation.h> 10 @interface CommunityTool : NSObject 11 + (void)SaveComunity:(NSArray *)homepageBeans; 12 + (NSMutableArray *)HomePageBean; 13 @end
1 // 2 // CommunityTool.m 3 // SmartCommunity 4 // 5 // Created by chenhuan on 15/9/2. 6 // Copyright (c) 2015年 smartcommunity. All rights reserved. 7 // 8 9 #import "CommunityTool.h" 10 11 #define SChomepagePath [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"homepage.archive"] 12 13 @implementation CommunityTool 14 + (void)SaveComunity:(NSArray *)homepageBeans{ 15 [NSKeyedArchiver archiveRootObject:homepageBeans toFile:SChomepagePath]; 16 } 17 + (NSMutableArray *)HomePageBean{ 18 return [NSKeyedUnarchiver unarchiveObjectWithFile:SChomepagePath]; 19 } 20 @end
标签:
原文地址:http://www.cnblogs.com/athook/p/4778980.html